Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mypy to 1.11.0 #2269

Merged
merged 6 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ We rely on different `django` and `mypy` versions:

| django-stubs | Mypy version | Django version | Django partial support | Python version |
|----------------|--------------|----------------|------------------------|----------------|
| 5.0.3 | 1.11.x | 5.0 | 4.2 | 3.8 - 3.12 |
| 5.0.2 | 1.10.x | 5.0 | 4.2 | 3.8 - 3.12 |
| 5.0.1 | 1.10.x | 5.0 | 4.2 | 3.8 - 3.12 |
| 5.0.0 | 1.10.x | 5.0 | 4.2, 4.1 | 3.8 - 3.12 |
Expand Down
2 changes: 1 addition & 1 deletion django-stubs/contrib/admin/utils.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def lookup_field(
name: Callable | str, obj: Model, model_admin: BaseModelAdmin | None = ...
) -> tuple[Field | None, str | None, Any]: ...
@overload
def label_for_field( # type: ignore[overload-overlap]
def label_for_field(
name: Callable | str,
model: type[Model],
model_admin: BaseModelAdmin | None = ...,
Expand Down
4 changes: 2 additions & 2 deletions django-stubs/db/models/sql/compiler.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ class SQLCompiler:
) -> Iterator[Sequence[Any]]: ...
def has_results(self) -> bool: ...
@overload
def execute_sql( # type: ignore[overload-overlap]
def execute_sql(
self, result_type: Literal["cursor"] = ..., chunked_fetch: bool = ..., chunk_size: int = ...
) -> CursorWrapper: ...
@overload
def execute_sql(
self, result_type: Literal["no results"] | None = ..., chunked_fetch: bool = ..., chunk_size: int = ...
) -> None: ...
@overload
def execute_sql( # type: ignore[overload-overlap]
def execute_sql(
self, result_type: Literal["single"] = ..., chunked_fetch: bool = ..., chunk_size: int = ...
) -> Iterable[Sequence[Any]] | None: ...
@overload
Expand Down
2 changes: 1 addition & 1 deletion django-stubs/forms/models.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ class ModelMultipleChoiceField(ModelChoiceField[_M]):

def modelform_defines_fields(form_class: type[ModelForm]) -> bool: ...
@overload
def _get_foreign_key( # type: ignore[overload-overlap]
def _get_foreign_key(
parent_model: type[Model], model: type[Model], fk_name: str | None = ..., can_fail: Literal[True] = ...
) -> ForeignKey | None: ...
@overload
Expand Down
2 changes: 1 addition & 1 deletion django-stubs/utils/encoding.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def iri_to_uri(iri: None) -> None: ...
@overload
def iri_to_uri(iri: str | Promise) -> str: ...
@overload
def uri_to_iri(uri: None) -> None: ... # type: ignore[overload-overlap]
def uri_to_iri(uri: None) -> None: ...
@overload
def uri_to_iri(uri: Any) -> str: ...
def escape_uri_path(path: str) -> str: ...
Expand Down
8 changes: 2 additions & 6 deletions django-stubs/utils/formats.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,11 @@ _T = TypeVar("_T")
# details it works as expected (all values from Union are `localize`d to str,
# while type of others is preserved)
@overload
def localize( # type: ignore[overload-overlap]
value: builtin_datetime | date | time | Decimal | float | str, use_l10n: bool | None = ...
) -> str: ...
def localize(value: builtin_datetime | date | time | Decimal | float | str, use_l10n: bool | None = ...) -> str: ...
@overload
def localize(value: _T, use_l10n: bool | None = ...) -> _T: ...
@overload
def localize_input( # type: ignore[overload-overlap]
value: builtin_datetime | date | time | Decimal | float | str, default: str | None = ...
) -> str: ...
def localize_input(value: builtin_datetime | date | time | Decimal | float | str, default: str | None = ...) -> str: ...
@overload
def localize_input(value: _T, default: str | None = ...) -> _T: ...
def sanitize_separators(value: _T) -> _T: ...
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ Django==5.0.7; python_version >= '3.10'
-e .[redis,compatible-mypy,oracle]

# Overrides:
mypy==1.10.1
mypy==1.11.0
pyright==1.1.373
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def find_stub_files(name: str) -> List[str]:

# Keep compatible-mypy major.minor version pinned to what we use in CI (requirements.txt)
extras_require = {
"compatible-mypy": ["mypy~=1.10.0"],
"compatible-mypy": ["mypy~=1.11.0"],
"redis": ["redis"],
"oracle": ["oracledb"],
}
Expand Down
2 changes: 1 addition & 1 deletion tests/typecheck/contrib/admin/test_decorators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@admin.display
def display_property(self) -> str: ...

@admin.display # E: Decorators on top of @property are not supported [misc]
@admin.display # E: Decorators on top of @property are not supported [prop-decorator]
@property
def incorrect_property(self) -> str: ...

Expand Down
Loading