Move folder_watcher imports at top-level (#29095)

pull/29113/head^2
Quentame 2019-11-26 19:09:20 +01:00 committed by Paulus Schoutsen
parent 7a04f0c0df
commit 4107fd9a25
1 changed files with 2 additions and 3 deletions

View File

@ -3,6 +3,8 @@ import logging
import os
import voluptuous as vol
from watchdog.events import PatternMatchingEventHandler
from watchdog.observers import Observer
from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP
import homeassistant.helpers.config_validation as cv
@ -50,7 +52,6 @@ def setup(hass, config):
def create_event_handler(patterns, hass):
"""Return the Watchdog EventHandler object."""
from watchdog.events import PatternMatchingEventHandler
class EventHandler(PatternMatchingEventHandler):
"""Class for handling Watcher events."""
@ -99,8 +100,6 @@ class Watcher:
def __init__(self, path, patterns, hass):
"""Initialise the watchdog observer."""
from watchdog.observers import Observer
self._observer = Observer()
self._observer.schedule(
create_event_handler(patterns, hass), path, recursive=True