MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / iter_bodies

Function iter_bodies

tools/PythonCheckerLib.py:30–50  ·  view source on GitHub ↗
(tree)

Source from the content-addressed store, hash-verified

28 root = pipeline[0](source) # only parser
29
30 def iter_bodies(tree):
31 try:
32 for n in tree.body.stats[0].stats:
33 # cimports at head of file
34 yield n
35 except Exception:
36 pass
37 if hasattr(tree.body, "stats"):
38 for s in tree.body.stats:
39 if isinstance(s, CDefExternNode):
40 body = s.body
41 if hasattr(body, "stats"):
42 for node in body.stats:
43 yield node
44 else:
45 yield body
46 elif hasattr(tree.body, "body"):
47 body = tree.body.body
48 yield body
49 else:
50 raise Exception("parse_pxd_file failed: no valied .pxd file !")
51
52 lines = open(path).readlines()
53

Callers 1

parse_pxd_fileFunction · 0.85

Calls 1

ExceptionClass · 0.85

Tested by

no test coverage detected