(pxdfiles, comp_name)
| 744 | |
| 745 | @staticmethod |
| 746 | def parse_multiple_files(pxdfiles, comp_name): |
| 747 | |
| 748 | def cimport(b, _, __): |
| 749 | print ("cimport", b.module_name, "as", b.as_name) |
| 750 | |
| 751 | handlers = { CEnumDefNode : EnumDecl.parseTree, |
| 752 | CppClassNode : CppClassDecl.parseTree, |
| 753 | CTypeDefNode : CTypeDefDecl.parseTree, |
| 754 | CVarDefNode : MethodOrAttributeDecl.parseTree, |
| 755 | CImportStatNode : cimport, |
| 756 | } |
| 757 | |
| 758 | found = False |
| 759 | # Go through all files and all classes in those files, trying to find |
| 760 | # the class whose C/C++ name matches the current compound name |
| 761 | for pxdfile in pxdfiles: |
| 762 | cython_file = parse_pxd_file(pxdfile) |
| 763 | for klass in cython_file: |
| 764 | if hasattr(klass[0], "cname"): |
| 765 | if klass[0].cname == comp_name: |
| 766 | found = True |
| 767 | if found: break |
| 768 | if found: break |
| 769 | |
| 770 | if not found: |
| 771 | error_str = "Could not find a match for class %s in file %s" % (comp_name, pxdfile) |
| 772 | raise PXDFileParseError(error_str) |
| 773 | |
| 774 | # Check if we really have a class, then initialize it |
| 775 | if isinstance(klass[0], CppClassNode): |
| 776 | cl = CppClassDecl.parseTree(klass[0], klass[1], klass[2]) |
| 777 | else: |
| 778 | print ("Something is wrong, not a class") |
| 779 | raise PXDFileParseError("wrong") |
| 780 | |
| 781 | cl.pxdfile = pxdfile |
| 782 | for klass in cython_file: |
| 783 | handler = handlers.get(type(klass[0])) |
| 784 | res = handler(klass[0], klass[1], klass[2]) |
| 785 | if "wrap-attach" in res.annotations: |
| 786 | if res.annotations["wrap-attach"] == cl.name: |
| 787 | ## attach this to the above class |
| 788 | cl.methods[res.name] = res |
| 789 | |
| 790 | return cl |
| 791 | |
| 792 | class TestResult: |
| 793 | """ A Result from a single test which either passed or failed. |
no test coverage detected