Skip to content

Commit b3636bb

Browse files
committed
Suppress pending issues in django-stubs
I have submitted PRs to address these, but they haven't made it into a release yet.
1 parent 82349a7 commit b3636bb

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

model_utils/managers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ def _get_subclasses_recurse(self, model: type[models.Model]) -> list[str]:
145145

146146
for rel in rels:
147147
for subclass in self._get_subclasses_recurse(rel.field.model):
148-
subclasses.append(rel.get_accessor_name() + LOOKUP_SEP + subclass)
149-
subclasses.append(rel.get_accessor_name())
148+
subclasses.append(cast(str, rel.get_accessor_name()) + LOOKUP_SEP + subclass)
149+
subclasses.append(cast(str, rel.get_accessor_name()))
150150
return subclasses
151151

152152
def _get_ancestors_path(self, model: type[models.Model]) -> str:
@@ -166,7 +166,7 @@ def _get_ancestors_path(self, model: type[models.Model]) -> str:
166166

167167
while parent_link is not None:
168168
related = parent_link.remote_field
169-
ancestry.insert(0, related.get_accessor_name())
169+
ancestry.insert(0, cast(str, related.get_accessor_name()))
170170

171171
parent_model = related.model
172172
parent_link = parent_model._meta.get_ancestor_link(self.model)
@@ -499,7 +499,7 @@ class Meta:
499499
join_field=self.model.tempmodel_set.rel,
500500
nullable=False
501501
)
502-
new_qs.query.join(conn, reuse=None)
502+
new_qs.query.join(conn, reuse=None) # type: ignore[arg-type]
503503
return new_qs
504504

505505

model_utils/tracker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def __getstate__(self) -> dict[str, Any]:
3434
"""
3535
We don't need to deepcopy the instance, so nullify if provided.
3636
"""
37-
state = super().__getstate__()
37+
state = super().__getstate__() # type: ignore[misc]
3838
if 'instance' in state:
3939
state['instance'] = None
4040
return state

tests/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ def __get__(self, obj: models.Model | None, cls: type[models.Model] | None = Non
389389
assert cls is not None
390390
fields_map = {f.name: f for f in cls._meta.fields}
391391
field = fields_map[self.name]
392-
DeferredAttribute(field=field).__get__(obj, cls)
392+
DeferredAttribute(field=field).__get__(obj, cls) # type: ignore[attr-defined]
393393
return str(obj.__dict__[self.name])
394394

395395
def __set__(self, obj: object, value: str) -> None:

tests/test_fields/test_field_tracker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def test_refresh_from_db(self) -> None:
225225
self.assertChanged(name='retro', number=4, mutable=[1, 2, 3])
226226
self.instance.refresh_from_db(fields=('name',))
227227
self.assertChanged(number=4, mutable=[1, 2, 3])
228-
self.instance.refresh_from_db(fields={'mutable'})
228+
self.instance.refresh_from_db(fields={'mutable'}) # type: ignore[arg-type]
229229
self.assertChanged(number=4)
230230
self.instance.refresh_from_db()
231231
self.assertChanged()

0 commit comments

Comments
 (0)