MCPcopy Create free account
hub / github.com/google-deepmind/dm_control / find_data_files

Function find_data_files

setup.py:144–164  ·  view source on GitHub ↗

Recursively finds files whose names match the given shell patterns.

(package_dir, patterns, excludes=())

Source from the content-addressed store, hash-verified

142
143
144def find_data_files(package_dir, patterns, excludes=()):
145 """Recursively finds files whose names match the given shell patterns."""
146 paths = set()
147
148 def is_excluded(s):
149 for exclude in excludes:
150 if fnmatch.fnmatch(s, exclude):
151 return True
152 return False
153
154 for directory, _, filenames in os.walk(package_dir):
155 if is_excluded(directory):
156 continue
157 for pattern in patterns:
158 for filename in fnmatch.filter(filenames, pattern):
159 # NB: paths must be relative to the package directory.
160 relative_dirpath = os.path.relpath(directory, package_dir)
161 full_path = os.path.join(relative_dirpath, filename)
162 if not is_excluded(full_path):
163 paths.add(full_path)
164 return list(paths)
165
166
167setup(

Callers 1

setup.pyFile · 0.85

Calls 2

is_excludedFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…