(tree)
| 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 |
no test coverage detected