Skip to content

Commit be074b4

Browse files
committed
re: #275 removed superfluous todos
1 parent 1614994 commit be074b4

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

src/watchdog/observers/inotify.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def on_event(self, event: InotifyEvent) -> None:
200200
return
201201
src_path = self._build_event_source_path(event)
202202

203-
# todo look into desired behavior for IN_MOVE_SELF events (keep watching?, stop watching?)
203+
# todo look into desired behavior for IN_MOVE_SELF events (keep watching?, stop watching?, are they even possible?)
204204
if event.is_moved_from:
205205
# TODO: When a directory from a watched directory
206206
# is moved into another part of the filesystem, this
@@ -244,14 +244,12 @@ def _recursive_simulate(self, src_path: bytes) -> list[InotifyEvent]:
244244
for dirname in dirnames:
245245
full_path = os.path.join(root, dirname)
246246
wd_dir = self._active_callbacks_by_path[os.path.dirname(full_path)]
247-
# todo handle missing callback because a subfolder has been created between self._add_all_callbacks(src_path) and this line of code.
248247
mask = Mask(InotifyConstants.IN_CREATE | InotifyConstants.IN_ISDIR)
249248
events.append(InotifyEvent(wd_dir, mask, 0, dirname))
250249

251250
for filename in filenames:
252251
full_path = os.path.join(root, filename)
253252
wd_parent_dir = self._active_callbacks_by_path[os.path.dirname(full_path)]
254-
# todo handle missing callback because a subfolder has been created between self._add_all_callbacks(src_path) and this line of code.
255253
mask = InotifyConstants.IN_CREATE
256254
events.append(InotifyEvent(wd_parent_dir, mask, 0, filename))
257255
return events
@@ -278,7 +276,8 @@ def _activate(self) -> None:
278276

279277
def _build_event_source_path(self, event: InotifyEvent) -> bytes | None:
280278
watched_path = self._active_callbacks_by_watch.get(event.wd)
281-
if watched_path is None: # todo investigate: can we *actually* get events for WatchDescriptor that have already been removed?
279+
if watched_path is None:
280+
# investigate: can we *actually* get events for a WatchDescriptor that has already been removed?
282281
return None
283282
return os.path.join(watched_path, event.name) if event.name else watched_path # avoid trailing slash
284283

src/watchdog/observers/inotify_c.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,6 @@
2828
raise UnsupportedLibcError(error)
2929

3030

31-
# ##############################################################################
32-
# TODOs:
33-
# - todo use enum.Flag for events & mask.
34-
# - todo handle watches that do not follow move events
35-
# - todo fire DirModifiedEvents (?)
36-
# - todo investigate: inotify does not generate move events for self? (e.g. watch on file F and F gets moved)
37-
# observation 1: watch follows the file, but no move event is generated.
38-
# - todo
39-
# ##############################################################################
40-
41-
4231
WatchDescriptor = NewType("WatchDescriptor", int)
4332
Mask = NewType("Mask", int)
4433

@@ -104,7 +93,7 @@ class InotifyConstants:
10493
IN_NONBLOCK: ClassVar[Mask] = 0x00004000
10594

10695

107-
INOTIFY_ALL_CONSTANTS: dict[str, Mask] = { # todo remove once mask uses enum.Flags.
96+
INOTIFY_ALL_CONSTANTS: dict[str, Mask] = {
10897
name: getattr(InotifyConstants, name)
10998
for name in dir(InotifyConstants)
11099
if name.startswith("IN_") and name not in {"IN_ALL_EVENTS", "IN_MOVE"}
@@ -130,7 +119,7 @@ class InotifyConstants:
130119
)
131120

132121

133-
def _get_mask_string(mask: int) -> str: # todo remove once mask uses enum.Flags.
122+
def _get_mask_string(mask: int) -> str:
134123
return "|".join(
135124
name for name, c_val in INOTIFY_ALL_CONSTANTS.items() if mask & c_val
136125
)

0 commit comments

Comments
 (0)