MCPcopy
hub / github.com/django/django / _update_watches

Method _update_watches

django/utils/autoreload.py:562–578  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

560 return frozenset((*extra_directories, *watched_file_dirs, *sys_paths))
561
562 def _update_watches(self):
563 watched_files = list(self.watched_files(include_globs=False))
564 found_roots = common_roots(self.watched_roots(watched_files))
565 logger.debug("Watching %s files", len(watched_files))
566 logger.debug("Found common roots: %s", found_roots)
567 # Setup initial roots for performance, shortest roots first.
568 for root in sorted(found_roots):
569 self._watch_root(root)
570 for directory, patterns in self.directory_globs.items():
571 self._watch_glob(directory, patterns)
572 # Group sorted watched_files by their parent directory.
573 sorted_files = sorted(watched_files, key=lambda p: p.parent)
574 for directory, group in itertools.groupby(sorted_files, key=lambda p: p.parent):
575 # These paths need to be relative to the parent directory.
576 self._subscribe_dir(
577 directory, [str(p.relative_to(directory)) for p in group]
578 )
579
580 def update_watches(self):
581 try:

Callers 1

update_watchesMethod · 0.95

Calls 8

watched_rootsMethod · 0.95
_watch_rootMethod · 0.95
_watch_globMethod · 0.95
_subscribe_dirMethod · 0.95
common_rootsFunction · 0.85
watched_filesMethod · 0.80
debugMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected