MCPcopy
hub / github.com/pallets/werkzeug / _iter_module_paths

Function _iter_module_paths

src/werkzeug/_reloader.py:43–60  ·  view source on GitHub ↗

Find the filesystem paths associated with imported modules.

()

Source from the content-addressed store, hash-verified

41
42
43def _iter_module_paths() -> t.Iterator[str]:
44 """Find the filesystem paths associated with imported modules."""
45 # List is in case the value is modified by the app while updating.
46 for module in list(sys.modules.values()):
47 name = getattr(module, "__file__", None)
48
49 if name is None or name.startswith(_ignore_always):
50 continue
51
52 while not os.path.isfile(name):
53 # Zip file, find the base file without the module path.
54 old = name
55 name = os.path.dirname(name)
56
57 if name == old: # skip if it was all directories somehow
58 break
59 else:
60 yield name
61
62
63def _remove_by_pattern(paths: set[str], exclude_patterns: set[str]) -> None:

Callers 2

_find_stat_pathsFunction · 0.85
_find_watchdog_pathsFunction · 0.85

Calls 2

listFunction · 0.50
valuesMethod · 0.45

Tested by

no test coverage detected