MCPcopy
hub / github.com/django/django / _subscribe

Method _subscribe

django/utils/autoreload.py:487–511  ·  view source on GitHub ↗
(self, directory, name, expression)

Source from the content-addressed store, hash-verified

485 return self.client.query("clock", root)["clock"]
486
487 def _subscribe(self, directory, name, expression):
488 root, rel_path = self._watch_root(directory)
489 # Only receive notifications of files changing, filtering out other
490 # types like special files:
491 # https://facebook.github.io/watchman/docs/type
492 only_files_expression = [
493 "allof",
494 ["anyof", ["type", "f"], ["type", "l"]],
495 expression,
496 ]
497 query = {
498 "expression": only_files_expression,
499 "fields": ["name"],
500 "since": self._get_clock(root),
501 "dedup_results": True,
502 }
503 if rel_path:
504 query["relative_root"] = rel_path
505 logger.debug(
506 "Issuing watchman subscription %s, for root %s. Query: %s",
507 name,
508 root,
509 query,
510 )
511 self.client.query("subscribe", root, name, query)
512
513 def _subscribe_dir(self, directory, filenames):
514 if not directory.exists():

Callers 2

_subscribe_dirMethod · 0.95
_watch_globMethod · 0.95

Calls 4

_watch_rootMethod · 0.95
_get_clockMethod · 0.95
queryMethod · 0.80
debugMethod · 0.45

Tested by

no test coverage detected