summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-07-04 21:43:02 +0200
committerChristian Poessinger <christian@poessinger.com>2021-07-04 21:43:04 +0200
commit70efa3dd54bc88a73f21a8c7d2e1eecb65f0508c (patch)
tree972a67b1a1c6d321e621c9834c518c60a902a554 /python
parentcaed454a1d1581cc476ceb27fea17d4ef6e77982 (diff)
downloadvyos-1x-70efa3dd54bc88a73f21a8c7d2e1eecb65f0508c.tar.gz
vyos-1x-70efa3dd54bc88a73f21a8c7d2e1eecb65f0508c.zip
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.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/util.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/python/vyos/util.py b/python/vyos/util.py
index 630fb1dcc..8247ccb2d 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
@@ -518,9 +515,12 @@ def wait_for_inotify(file_path, event_type=None, timeout=None, sleep_interval=0.
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))
for event in i.event_gen(yield_nones=True):