MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / read_argspec_from_file

Function read_argspec_from_file

tools/check_api_compatible.py:112–129  ·  view source on GitHub ↗

read FullArgSpec from spec file

(specfile)

Source from the content-addressed store, hash-verified

110
111
112def read_argspec_from_file(specfile):
113 """
114 read FullArgSpec from spec file
115 """
116 res_dict = {}
117 patArgSpec = re.compile(
118 r'^(paddle[^,]+)\s+\((ArgSpec.*),\s\(\'document\W*([0-9a-z]{32})'
119 )
120 fullargspec_prefix = 'inspect.Full'
121 for line in specfile.readlines():
122 mo = patArgSpec.search(line)
123 if mo and mo.group(2) != 'ArgSpec()':
124 logger.debug("%s argspec: %s", mo.group(1), mo.group(2))
125 try:
126 res_dict[mo.group(1)] = eval(fullargspec_prefix + mo.group(2))
127 except: # SyntaxError, NameError:
128 res_dict[mo.group(1)] = fullargspec_prefix + mo.group(2)
129 return res_dict
130
131
132arguments = [

Callers 2

test_case_normalMethod · 0.90

Calls 5

evalFunction · 0.85
compileMethod · 0.45
searchMethod · 0.45
groupMethod · 0.45
debugMethod · 0.45

Tested by 1

test_case_normalMethod · 0.72