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

Function _KeyToFilePath

tensorflow/tools/api/tests/api_compatibility_test.py:87–107  ·  view source on GitHub ↗

From a given key, construct a filepath. Filepath will be inside golden folder for api_version. Args: key: a string used to determine the file path api_version: a number indicating the tensorflow API version, e.g. 1 or 2. Returns: A string of file path to the pbtxt file which des

(key, api_version)

Source from the content-addressed store, hash-verified

85
86
87def _KeyToFilePath(key, api_version):
88 """From a given key, construct a filepath.
89
90 Filepath will be inside golden folder for api_version.
91
92 Args:
93 key: a string used to determine the file path
94 api_version: a number indicating the tensorflow API version, e.g. 1 or 2.
95
96 Returns:
97 A string of file path to the pbtxt file which describes the public API
98 """
99
100 def _ReplaceCapsWithDash(matchobj):
101 match = matchobj.group(0)
102 return '-%s' % (match.lower())
103
104 case_insensitive_key = re.sub('([A-Z]{1})', _ReplaceCapsWithDash, key)
105 api_folder = (
106 _API_GOLDEN_FOLDER_V2 if api_version == 2 else _API_GOLDEN_FOLDER_V1)
107 return os.path.join(api_folder, '%s.pbtxt' % case_insensitive_key)
108
109
110def _FileNameToKey(filename):

Calls 2

subMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected