determine if 'given' corresponds to 'entity', in terms of an entity passed to Query that would match the same entity being referred to elsewhere in the query.
(
given: _InternalEntityType[Any], entity: _InternalEntityType[Any]
)
| 2107 | |
| 2108 | |
| 2109 | def _entity_corresponds_to( |
| 2110 | given: _InternalEntityType[Any], entity: _InternalEntityType[Any] |
| 2111 | ) -> bool: |
| 2112 | """determine if 'given' corresponds to 'entity', in terms |
| 2113 | of an entity passed to Query that would match the same entity |
| 2114 | being referred to elsewhere in the query. |
| 2115 | |
| 2116 | """ |
| 2117 | if insp_is_aliased_class(entity): |
| 2118 | if insp_is_aliased_class(given): |
| 2119 | if entity._base_alias() is given._base_alias(): |
| 2120 | return True |
| 2121 | return False |
| 2122 | elif insp_is_aliased_class(given): |
| 2123 | if given._use_mapper_path: |
| 2124 | return entity in given.with_polymorphic_mappers |
| 2125 | else: |
| 2126 | return entity is given |
| 2127 | |
| 2128 | assert insp_is_mapper(given) |
| 2129 | return entity.common_parent(given) |
| 2130 | |
| 2131 | |
| 2132 | def _entity_corresponds_to_use_path_impl( |
no test coverage detected