| 2844 | |
| 2845 | |
| 2846 | class _BundleEntity(_QueryEntity): |
| 2847 | _extra_entities = () |
| 2848 | |
| 2849 | __slots__ = ( |
| 2850 | "bundle", |
| 2851 | "expr", |
| 2852 | "type", |
| 2853 | "_label_name", |
| 2854 | "_entities", |
| 2855 | "supports_single_entity", |
| 2856 | ) |
| 2857 | |
| 2858 | _entities: List[_QueryEntity] |
| 2859 | bundle: Bundle |
| 2860 | type: Type[Any] |
| 2861 | _label_name: str |
| 2862 | supports_single_entity: bool |
| 2863 | expr: Bundle |
| 2864 | |
| 2865 | def __init__( |
| 2866 | self, |
| 2867 | compile_state, |
| 2868 | expr, |
| 2869 | entities_collection, |
| 2870 | is_current_entities, |
| 2871 | setup_entities=True, |
| 2872 | parent_bundle=None, |
| 2873 | ): |
| 2874 | compile_state._has_orm_entities = True |
| 2875 | |
| 2876 | expr = expr._annotations["bundle"] |
| 2877 | if parent_bundle: |
| 2878 | parent_bundle._entities.append(self) |
| 2879 | else: |
| 2880 | entities_collection.append(self) |
| 2881 | |
| 2882 | if isinstance( |
| 2883 | expr, (attributes.QueryableAttribute, interfaces.PropComparator) |
| 2884 | ): |
| 2885 | bundle = expr.__clause_element__() |
| 2886 | else: |
| 2887 | bundle = expr |
| 2888 | |
| 2889 | self.bundle = self.expr = bundle |
| 2890 | self.type = type(bundle) |
| 2891 | self._label_name = bundle.name |
| 2892 | self._entities = [] |
| 2893 | |
| 2894 | if setup_entities: |
| 2895 | for expr in bundle.exprs: |
| 2896 | if "bundle" in expr._annotations: |
| 2897 | _BundleEntity( |
| 2898 | compile_state, |
| 2899 | expr, |
| 2900 | entities_collection, |
| 2901 | is_current_entities, |
| 2902 | parent_bundle=self, |
| 2903 | ) |
no outgoing calls
no test coverage detected