read FullArgSpec from spec file
(specfile)
| 110 | |
| 111 | |
| 112 | def 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 | |
| 132 | arguments = [ |