Skip to content

Commit

Permalink
simplify handling of created and removed events
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Schott committed Jan 20, 2021
1 parent 995458b commit 75afbd2
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/watchdog/observers/fsevents.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,7 @@ def queue_events(self, timeout, events):

if event.is_created:
cls = DirCreatedEvent if event.is_directory else FileCreatedEvent
if not event.is_coalesced or (
event.is_coalesced and not event.is_renamed and not event.is_modified and not
event.is_inode_meta_mod and not event.is_xattr_mod
):
if os.path.exists(event.path):
self.queue_event(cls(src_path))
self.queue_event(DirModifiedEvent(os.path.dirname(src_path)))

Expand All @@ -138,7 +135,7 @@ def queue_events(self, timeout, events):

if event.is_removed:
cls = DirDeletedEvent if event.is_directory else FileDeletedEvent
if not event.is_coalesced or (event.is_coalesced and not os.path.exists(event.path)):
if not os.path.exists(event.path):
self.queue_event(cls(src_path))
self.queue_event(DirModifiedEvent(os.path.dirname(src_path)))

Expand Down

0 comments on commit 75afbd2

Please sign in to comment.