(self, types, searchStack=True, searchParents=True)
| 693 | return rv |
| 694 | |
| 695 | def _findType(self, types, searchStack=True, searchParents=True): |
| 696 | |
| 697 | if searchStack: |
| 698 | rv = [] |
| 699 | for obj in self.objects: |
| 700 | if isinstance(obj, types): |
| 701 | rv.append(obj) |
| 702 | # unpack compounds in a special way when looking for Solids |
| 703 | elif isinstance(obj, Compound) and types == (Solid,): |
| 704 | for T in types: |
| 705 | # _entities(...) needed due to weird behavior with shelled object unpacking |
| 706 | rv.extend(T(el) for el in obj._entities(T.__name__)) |
| 707 | # otherwise unpack compounds normally |
| 708 | elif isinstance(obj, Compound): |
| 709 | rv.extend(el for el in obj if isinstance(el, type)) |
| 710 | |
| 711 | if rv and types == (Solid,): |
| 712 | return Compound.makeCompound(rv) |
| 713 | elif rv: |
| 714 | return rv[0] |
| 715 | |
| 716 | if searchParents and self.parent is not None: |
| 717 | return self.parent._findType(types, searchStack=True, searchParents=True) |
| 718 | |
| 719 | return None |
| 720 | |
| 721 | def findSolid( |
| 722 | self, searchStack: bool = True, searchParents: bool = True |
no test coverage detected