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

Function parser

tensorflow/contrib/learn/python/learn/utils/gc_test.py:35–46  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

33def _create_parser(base_dir):
34 # create a simple parser that pulls the export_version from the directory.
35 def parser(path):
36 # Modify the path object for RegEx match for Windows Paths
37 if os.name == "nt":
38 match = re.match(
39 r"^" + compat.as_str_any(base_dir).replace("\\", "/") + r"/(\d+)$",
40 compat.as_str_any(path.path).replace("\\", "/"))
41 else:
42 match = re.match(r"^" + compat.as_str_any(base_dir) + r"/(\d+)$",
43 compat.as_str_any(path.path))
44 if not match:
45 return None
46 return path._replace(export_version=int(match.group(1)))
47
48 return parser
49

Callers 2

get_pathsFunction · 0.85
get_pathsFunction · 0.85

Calls 3

replaceMethod · 0.80
matchMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected