@@ -31,7 +31,6 @@ class ConfigWatcher(object):
31
31
running = False
32
32
refresh_delay_secs = 1
33
33
34
- # Constructor
35
34
def __init__ (self , watch_paths , call_func_on_change = None , * args , ** kwargs ):
36
35
self ._cached_stamp = {}
37
36
self .logger = getBridgeLogger ()
@@ -41,7 +40,6 @@ def __init__(self, watch_paths, call_func_on_change=None, *args, **kwargs):
41
40
self .args = args
42
41
self .kwargs = kwargs
43
42
44
-
45
43
def update_files_list (self ):
46
44
oldfiles = self .filenames .copy ()
47
45
for path in self .paths :
@@ -57,9 +55,8 @@ def update_files_list(self):
57
55
for file in self .filenames .difference (oldfiles ):
58
56
self .logger .debug (MSG ['FileAddedToWatch' ].format (file ))
59
57
60
-
61
- # Look for changes
62
58
def look (self ):
59
+ """ Function to check if a file timestamp has changed"""
63
60
for filename in self .filenames :
64
61
stamp = os .stat (filename ).st_mtime
65
62
if filename not in self ._cached_stamp :
@@ -71,8 +68,8 @@ def look(self):
71
68
if self .call_func_on_change is not None :
72
69
self .call_func_on_change (* self .args , ** self .kwargs )
73
70
74
- # Keep watching in a loop
75
71
def watch (self ):
72
+ """ Function to keep watching in a loop """
76
73
self .running = True
77
74
self .logger .debug (MSG ['StartWatchingFiles' ].format (self .paths ))
78
75
while self .running :
@@ -93,8 +90,6 @@ def watch(self):
93
90
self .logger .details (MSG ['UnhandledError' ].format (type (e ).__name__ ))
94
91
break
95
92
96
-
97
- # break watching
98
93
def stop_watch (self ):
94
+ """ Function to break watching """
99
95
self .running = False
100
-
0 commit comments