MCPcopy Index your code
hub / github.com/fabioz/PyDev.Debugger / setup_auto_reload_watcher

Method setup_auto_reload_watcher

pydevd.py:812–880  ·  view source on GitHub ↗
(self, enable_auto_reload, watch_dirs, poll_target_time, exclude_patterns, include_patterns)

Source from the content-addressed store, hash-verified

810 return collect_try_except_info(code_obj)
811
812 def setup_auto_reload_watcher(self, enable_auto_reload, watch_dirs, poll_target_time, exclude_patterns, include_patterns):
813 try:
814 with self._lock_create_fs_notify:
815 # When setting up, dispose of the previous one (if any).
816 if self._fsnotify_thread is not None:
817 self._fsnotify_thread.do_kill_pydev_thread()
818 self._fsnotify_thread = None
819
820 if not enable_auto_reload:
821 return
822
823 exclude_patterns = tuple(exclude_patterns)
824 include_patterns = tuple(include_patterns)
825
826 def accept_directory(absolute_filename, cache={}):
827 try:
828 return cache[absolute_filename]
829 except:
830 if absolute_filename and absolute_filename[-1] not in ("/", "\\"):
831 # I.e.: for directories we always end with '/' or '\\' so that
832 # we match exclusions such as "**/node_modules/**"
833 absolute_filename += os.path.sep
834
835 # First include what we want
836 for include_pattern in include_patterns:
837 if glob_matches_path(absolute_filename, include_pattern):
838 cache[absolute_filename] = True
839 return True
840
841 # Then exclude what we don't want
842 for exclude_pattern in exclude_patterns:
843 if glob_matches_path(absolute_filename, exclude_pattern):
844 cache[absolute_filename] = False
845 return False
846
847 # By default track all directories not excluded.
848 cache[absolute_filename] = True
849 return True
850
851 def accept_file(absolute_filename, cache={}):
852 try:
853 return cache[absolute_filename]
854 except:
855 # First include what we want
856 for include_pattern in include_patterns:
857 if glob_matches_path(absolute_filename, include_pattern):
858 cache[absolute_filename] = True
859 return True
860
861 # Then exclude what we don't want
862 for exclude_pattern in exclude_patterns:
863 if glob_matches_path(absolute_filename, exclude_pattern):
864 cache[absolute_filename] = False
865 return False
866
867 # By default don't track files not included.
868 cache[absolute_filename] = False
869 return False

Callers

nothing calls this directly

Calls 5

FSNotifyThreadClass · 0.90
PyDevdAPIClass · 0.90
exceptionMethod · 0.80
do_kill_pydev_threadMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected