From 0a4b21ebaf126e418e508c839cd80d1d72b259c9 Mon Sep 17 00:00:00 2001 From: Rob McBroom Date: Mon, 8 Aug 2016 10:14:41 -0400 Subject: [PATCH 1/2] identify synthesized events --- src/watchdog/events.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) mode change 100644 => 100755 src/watchdog/events.py diff --git a/src/watchdog/events.py b/src/watchdog/events.py old mode 100644 new mode 100755 index 7c1f07509..d61d16181 --- a/src/watchdog/events.py +++ b/src/watchdog/events.py @@ -114,6 +114,9 @@ class FileSystemEvent(object): is_directory = False """True if event was emitted for a directory; False otherwise.""" + is_synthetic = False + """True if event was synthesized; False otherwise.""" + def __init__(self, src_path): self._src_path = src_path @@ -590,11 +593,15 @@ def generate_sub_moved_events(src_dir_path, dest_dir_path): for directory in directories: full_path = os.path.join(root, directory) renamed_path = full_path.replace(dest_dir_path, src_dir_path) if src_dir_path else None - yield DirMovedEvent(renamed_path, full_path) + event = DirMovedEvent(renamed_path, full_path) + event.is_synthetic = True + yield event for filename in filenames: full_path = os.path.join(root, filename) renamed_path = full_path.replace(dest_dir_path, src_dir_path) if src_dir_path else None - yield FileMovedEvent(renamed_path, full_path) + event = FileMovedEvent(renamed_path, full_path) + event.is_synthetic = True + yield event def generate_sub_created_events(src_dir_path): From 7805e38fc540348ee646540513fce2b233c9a893 Mon Sep 17 00:00:00 2001 From: Rob McBroom Date: Wed, 1 Feb 2017 09:40:00 -0500 Subject: [PATCH 2/2] =?UTF-8?q?clarify=20what=20makes=20an=20event=20?= =?UTF-8?q?=E2=80=9Csynthetic=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/watchdog/events.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/watchdog/events.py b/src/watchdog/events.py index d61d16181..074452248 100755 --- a/src/watchdog/events.py +++ b/src/watchdog/events.py @@ -115,7 +115,12 @@ class FileSystemEvent(object): """True if event was emitted for a directory; False otherwise.""" is_synthetic = False - """True if event was synthesized; False otherwise.""" + """ + True if event was synthesized; False otherwise. + + These are move events that weren't actually broadcast by the OS, but + are presumed to have happened based on other, actual events. + """ def __init__(self, src_path): self._src_path = src_path