MCPcopy Create free account
hub / github.com/SourceCode-AI/aura / main

Function main

aura/analyzers/python_src_inspector.py:188–213  ·  view source on GitHub ↗
(pth=None, out=sys.stdout)

Source from the content-addressed store, hash-verified

186
187
188def main(pth=None, out=sys.stdout):
189 if "--environment-only" in sys.argv:
190 print(json.dumps(get_environment()), file=out)
191 return sys.exit(0)
192
193 if pth is None:
194 pth = sys.argv[1]
195
196 if pth != "-":
197 encoding = get_encoding(pth)
198
199 with open(pth, "rb") as fd:
200 source_code = fd.read()
201 else:
202 encoding = sys.getdefaultencoding()
203 source_code = sys.stdin.read()
204
205 try:
206 src_dump = collect(source_code=source_code, encoding=encoding)
207 print(json.dumps(src_dump), file=out)
208 except SyntaxError:
209 traceback.print_exc(file=sys.stderr)
210 sys.exit(1)
211 except Exception:
212 print("Error parsing source code for file: " + pth, file=sys.stderr)
213 raise
214
215
216if __name__ == "__main__":

Callers 1

Calls 4

get_environmentFunction · 0.85
get_encodingFunction · 0.85
collectFunction · 0.85
readMethod · 0.80

Tested by

no test coverage detected