From 4914f140d97749dd1009bdc78a201f27b452bee1 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 4 Jul 2021 21:43:02 +0200 Subject: vyos.util: T3663: move inotify-based imports to function level Keep the vyos.util function clean and not pull in the rest of the world when importing it. --- python/vyos/util.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'python') diff --git a/python/vyos/util.py b/python/vyos/util.py index b611dea4c..d88ca72c0 100644 --- a/python/vyos/util.py +++ b/python/vyos/util.py @@ -16,9 +16,6 @@ import os import re import sys -import time - -import inotify.adapters # # NOTE: Do not import full classes here, move your import to the function @@ -519,9 +516,12 @@ def wait_for_inotify(file_path, pre_hook=None, event_type=None, timeout=None, sl raise ValueError( "File path {} does not have a file part, do not know what to watch for".format(file_path)) - time_start = time.time() + from inotify.adapters import Inotify + from time import time + + time_start = time() - i = inotify.adapters.Inotify() + i = Inotify() i.add_watch(os.path.dirname(file_path)) if pre_hook: -- cgit v1.2.3