Skip to content

Commit 1078553

Browse files
committed
Update internal type: ignore comments and formatting for inspect(Any)
1 parent e318583 commit 1078553

4 files changed

Lines changed: 5 additions & 6 deletions

File tree

‎lib/sqlalchemy/orm/query.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,7 @@ def with_parent(
13071307
for prop in mapper.iterate_properties:
13081308
if (
13091309
isinstance(prop, relationships.RelationshipProperty)
1310-
and prop.mapper is entity_zero.mapper # type: ignore[union-attr] # noqa: E501
1310+
and prop.mapper is entity_zero.mapper
13111311
):
13121312
property = prop # type: ignore[assignment] # noqa: A001
13131313
break
@@ -1316,7 +1316,7 @@ def with_parent(
13161316
"Could not locate a property which relates instances "
13171317
"of class '%s' to instances of class '%s'"
13181318
% (
1319-
entity_zero.mapper.class_.__name__, # type: ignore[union-attr] # noqa: E501
1319+
entity_zero.mapper.class_.__name__,
13201320
instance.__class__.__name__,
13211321
)
13221322
)
@@ -1325,7 +1325,7 @@ def with_parent(
13251325
with_parent(
13261326
instance,
13271327
property, # type: ignore[arg-type]
1328-
entity_zero.entity, # type: ignore[union-attr]
1328+
entity_zero.entity,
13291329
)
13301330
)
13311331

‎lib/sqlalchemy/orm/relationships.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ def adapt_to_entity(
667667

668668
def _memoized_attr_entity(self) -> _InternalEntityType[_PT]:
669669
if self._of_type:
670-
return inspect(self._of_type) # type: ignore[return-value]
670+
return inspect(self._of_type) # type: ignore[no-any-return]
671671
else:
672672
return self.prop.entity
673673

‎lib/sqlalchemy/orm/strategy_options.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2407,7 +2407,7 @@ def _parse_attr_argument(
24072407
# TODO: need to figure out this None thing being returned by
24082408
# inspect(), it should not have None as an option in most cases
24092409
# if at all
2410-
insp: InspectionAttr = inspect(attr) # type: ignore[assignment]
2410+
insp: InspectionAttr = inspect(attr)
24112411
except sa_exc.NoInspectionAvailable as err:
24122412
raise sa_exc.ArgumentError(
24132413
"expected ORM mapped attribute for loader strategy argument"

‎test/typing/plain_files/inspection_inspect.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,3 @@ def check_any_subject(obj: Named, flag: bool) -> None:
8080
inspect(obj).identity
8181
# EXPECTED_MYPY: Item "None" of "Any | None" has no attribute "identity"
8282
inspect(obj, raiseerr=flag).identity
83-

0 commit comments

Comments
 (0)