From 4107fd9a2501c2871a4d384307d58b697c31cc0a Mon Sep 17 00:00:00 2001 From: Quentame Date: Tue, 26 Nov 2019 19:09:20 +0100 Subject: [PATCH] Move folder_watcher imports at top-level (#29095) --- homeassistant/components/folder_watcher/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/folder_watcher/__init__.py b/homeassistant/components/folder_watcher/__init__.py index b328744aaba..d99e4928cc5 100644 --- a/homeassistant/components/folder_watcher/__init__.py +++ b/homeassistant/components/folder_watcher/__init__.py @@ -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