Skip to content

Commit febc04e

Browse files
authored
Upgrade to mypy 1.7.0 (#1837)
1 parent eda5787 commit febc04e

File tree

16 files changed

+30
-28
lines changed

16 files changed

+30
-28
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ We rely on different `django` and `mypy` versions:
4949

5050
| django-stubs | Mypy version | Django version | Django partial support | Python version |
5151
|----------------|--------------|----------------|------------------------|----------------|
52+
| (next version) | 1.7.x | 4.2 | 4.1, 3.2 | 3.8 - 3.12 |
5253
| 4.2.6 | 1.6.x | 4.2 | 4.1, 3.2 | 3.8 - 3.12 |
5354
| 4.2.5 | 1.6.x | 4.2 | 4.1, 3.2 | 3.8 - 3.12 |
5455
| 4.2.4 | 1.5.x | 4.2 | 4.1, 3.2 | 3.8 - 3.11 |

django-stubs/contrib/admin/utils.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def lookup_field(
6969
name: Callable | str, obj: Model, model_admin: BaseModelAdmin | None = ...
7070
) -> tuple[Field | None, str | None, Any]: ...
7171
@overload
72-
def label_for_field( # type: ignore[misc]
72+
def label_for_field( # type: ignore[overload-overlap]
7373
name: Callable | str,
7474
model: type[Model],
7575
model_admin: BaseModelAdmin | None = ...,

django-stubs/core/files/base.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ from typing_extensions import Self
99
class File(FileProxyMixin[AnyStr], IO[AnyStr]):
1010
DEFAULT_CHUNK_SIZE: int
1111
file: IO[AnyStr] | None
12-
name: str | None # type: ignore[assignment]
12+
name: str | None
1313
mode: str
1414
def __init__(self, file: IO[AnyStr] | None, name: str | None = ...) -> None: ...
1515
def __bool__(self) -> bool: ...

django-stubs/db/backends/utils.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ class CursorDebugWrapper(CursorWrapper):
6969
) -> Generator[None, None, None]: ...
7070

7171
@overload
72-
def typecast_date(s: None | Literal[""]) -> None: ... # type: ignore[misc]
72+
def typecast_date(s: None | Literal[""]) -> None: ... # type: ignore[overload-overlap]
7373
@overload
7474
def typecast_date(s: str) -> datetime.date: ...
7575
@overload
76-
def typecast_time(s: None | Literal[""]) -> None: ... # type: ignore[misc]
76+
def typecast_time(s: None | Literal[""]) -> None: ... # type: ignore[overload-overlap]
7777
@overload
7878
def typecast_time(s: str) -> datetime.time: ...
7979
@overload
80-
def typecast_timestamp(s: None | Literal[""]) -> None: ... # type: ignore[misc]
80+
def typecast_timestamp(s: None | Literal[""]) -> None: ... # type: ignore[overload-overlap]
8181
@overload
8282
def typecast_timestamp(s: str) -> datetime.datetime: ...
8383
def split_identifier(identifier: str) -> tuple[str, str]: ...

django-stubs/db/models/sql/compiler.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,15 @@ class SQLCompiler:
9797
) -> Iterator[Sequence[Any]]: ...
9898
def has_results(self) -> bool: ...
9999
@overload
100-
def execute_sql( # type: ignore[misc]
100+
def execute_sql( # type: ignore[overload-overlap]
101101
self, result_type: Literal["cursor"] = ..., chunked_fetch: bool = ..., chunk_size: int = ...
102102
) -> CursorWrapper: ...
103103
@overload
104104
def execute_sql(
105105
self, result_type: Literal["no results"] | None = ..., chunked_fetch: bool = ..., chunk_size: int = ...
106106
) -> None: ...
107107
@overload
108-
def execute_sql( # type: ignore[misc]
108+
def execute_sql( # type: ignore[overload-overlap]
109109
self, result_type: Literal["single"] = ..., chunked_fetch: bool = ..., chunk_size: int = ...
110110
) -> Iterable[Sequence[Any]] | None: ...
111111
@overload

django-stubs/forms/models.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ class ModelMultipleChoiceField(ModelChoiceField):
304304

305305
def modelform_defines_fields(form_class: type[ModelForm]) -> bool: ...
306306
@overload
307-
def _get_foreign_key( # type: ignore[misc]
307+
def _get_foreign_key( # type: ignore[overload-overlap]
308308
parent_model: type[Model], model: type[Model], fk_name: str | None = ..., can_fail: Literal[True] = ...
309309
) -> ForeignKey | None: ...
310310
@overload

django-stubs/template/response.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class ContentNotRenderedError(Exception): ...
1919
class SimpleTemplateResponse(HttpResponse):
2020
content: Any
2121
closed: bool
22-
cookies: SimpleCookie[str]
22+
cookies: SimpleCookie[str] # type: ignore[type-arg]
2323
status_code: int
2424
rendering_attrs: Any
2525
template_name: _TemplateForResponseT
@@ -50,7 +50,7 @@ class TemplateResponse(SimpleTemplateResponse):
5050
closed: bool
5151
context: RequestContext
5252
context_data: dict[str, Any] | None
53-
cookies: SimpleCookie[str]
53+
cookies: SimpleCookie[str] # type: ignore[type-arg]
5454
csrf_cookie_set: bool
5555
json: functools.partial
5656
_request: HttpRequest

django-stubs/utils/encoding.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def iri_to_uri(iri: None) -> None: ...
6060
@overload
6161
def iri_to_uri(iri: str | Promise) -> str: ...
6262
@overload
63-
def uri_to_iri(uri: None) -> None: ... # type: ignore[misc]
63+
def uri_to_iri(uri: None) -> None: ... # type: ignore[overload-overlap]
6464
@overload
6565
def uri_to_iri(uri: Any) -> str: ...
6666
def escape_uri_path(path: str) -> str: ...

django-stubs/utils/formats.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ _T = TypeVar("_T")
3030
# details it works as expected (all values from Union are `localize`d to str,
3131
# while type of others is preserved)
3232
@overload
33-
def localize( # type: ignore[misc]
33+
def localize( # type: ignore[overload-overlap]
3434
value: builtin_datetime | date | time | Decimal | float | str, use_l10n: bool | None = ...
3535
) -> str: ...
3636
@overload
3737
def localize(value: _T, use_l10n: bool | None = ...) -> _T: ...
3838
@overload
39-
def localize_input( # type: ignore[misc]
39+
def localize_input( # type: ignore[overload-overlap]
4040
value: builtin_datetime | date | time | Decimal | float | str, default: str | None = ...
4141
) -> str: ...
4242
@overload

django-stubs/utils/xmlutils.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
from xml.sax.saxutils import XMLGenerator
2+
from xml.sax.xmlreader import AttributesImpl
23

34
class UnserializableContentError(ValueError): ...
45

56
class SimplerXMLGenerator(XMLGenerator):
67
def addQuickElement(self, name: str, contents: str | None = ..., attrs: dict[str, str] | None = ...) -> None: ...
78
def characters(self, content: str) -> None: ...
8-
def startElement(self, name: str, attrs: dict[str, str]) -> None: ...
9+
def startElement(self, name: str, attrs: AttributesImpl) -> None: ...

0 commit comments

Comments
 (0)