MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / get_paths

Function get_paths

tensorflow/contrib/learn/python/learn/utils/gc.py:193–220  ·  view source on GitHub ↗

Gets a list of Paths in a given directory. Args: base_dir: directory. parser: a function which gets the raw Path and can augment it with information such as the export_version, or ignore the path by returning None. An example parser may extract the export version from a path

(base_dir, parser)

Source from the content-addressed store, hash-verified

191
192@deprecated(None, 'Please implement your own file name management.')
193def get_paths(base_dir, parser):
194 """Gets a list of Paths in a given directory.
195
196 Args:
197 base_dir: directory.
198 parser: a function which gets the raw Path and can augment it with
199 information such as the export_version, or ignore the path by returning
200 None. An example parser may extract the export version from a path
201 such as "/tmp/exports/100" an another may extract from a full file
202 name such as "/tmp/checkpoint-99.out".
203
204 Returns:
205 A list of Paths contained in the base directory with the parsing function
206 applied.
207 By default the following fields are populated,
208 - Path.path
209 The parsing function is responsible for populating,
210 - Path.export_version
211 """
212 raw_paths = gfile.ListDirectory(base_dir)
213 paths = []
214 for r in raw_paths:
215 p = parser(Path(os.path.join(compat.as_str_any(base_dir),
216 compat.as_str_any(r)),
217 None))
218 if p:
219 paths.append(p)
220 return sorted(paths)

Callers

nothing calls this directly

Calls 4

parserFunction · 0.85
PathEnum · 0.85
joinMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected