MCPcopy
hub / github.com/django/django / tick

Method tick

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

Source from the content-addressed store, hash-verified

402 SLEEP_TIME = 1 # Check for changes once per second.
403
404 def tick(self):
405 mtimes = {}
406 while True:
407 for filepath, mtime in self.snapshot_files():
408 old_time = mtimes.get(filepath)
409 mtimes[filepath] = mtime
410 if old_time is None:
411 logger.debug("File %s first seen with mtime %s", filepath, mtime)
412 continue
413 elif mtime > old_time:
414 logger.debug(
415 "File %s previous mtime: %s, current mtime: %s",
416 filepath,
417 old_time,
418 mtime,
419 )
420 self.notify_file_changed(filepath)
421
422 time.sleep(self.SLEEP_TIME)
423 yield
424
425 def snapshot_files(self):
426 # watched_files may produce duplicate paths if globs overlap.

Callers

nothing calls this directly

Calls 5

snapshot_filesMethod · 0.95
notify_file_changedMethod · 0.80
sleepMethod · 0.80
getMethod · 0.45
debugMethod · 0.45

Tested by

no test coverage detected