MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / walk_directory

Function walk_directory

tools/update_license_headers.py:21–44  ·  view source on GitHub ↗

Talk the directory.

(entry)

Source from the content-addressed store, hash-verified

19
20
21def walk_directory(entry):
22 """Talk the directory."""
23
24 if "header" not in entry:
25 raise ValueError("Current entry does not have a header.")
26 if "include" not in entry:
27 raise ValueError("Current entry does not have an include list.")
28
29 def _list_include():
30 """List all files specified in the include list."""
31 for include_pattern in entry["include"]:
32 yield from glob.iglob(include_pattern, recursive=True)
33
34 def _filter_exclude(iterable):
35 """Filter filenames from an iterator by the exclude patterns."""
36 for filename in iterable:
37 for exclude_pattern in entry.get("exclude", []):
38 if fnmatch.fnmatch(filename, exclude_pattern):
39 break
40 else:
41 yield filename
42
43 files = _filter_exclude(set(_list_include()))
44 return list(files)
45
46
47def main(input_file="NOTICE.yml"):

Callers 1

mainFunction · 0.85

Calls 2

_filter_excludeFunction · 0.85
_list_includeFunction · 0.85

Tested by

no test coverage detected