Skip to content

Commit 15a7f7e

Browse files
authored
Use PEP 570 syntax (#1908)
1 parent 971a2f3 commit 15a7f7e

File tree

16 files changed

+34
-34
lines changed

16 files changed

+34
-34
lines changed

django-stubs/contrib/auth/password_validation.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ _UserModel: TypeAlias = Model
99

1010
@type_check_only
1111
class PasswordValidator(Protocol):
12-
def validate(self, __password: str, __user: _UserModel | None = ...) -> None: ...
12+
def validate(self, password: str, user: _UserModel | None = ..., /) -> None: ...
1313
def get_help_text(self) -> str: ...
1414

1515
def get_default_password_validators() -> list[PasswordValidator]: ...

django-stubs/contrib/gis/utils/layermapping.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class MissingForeignKey(LayerMapError): ...
1616

1717
@type_check_only
1818
class _Writer(Protocol):
19-
def write(self, __s: str) -> Any: ...
19+
def write(self, s: str, /) -> Any: ...
2020

2121
class LayerMapping:
2222
MULTI_TYPES: dict[int, OGRGeomType]

django-stubs/core/checks/registry.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class CheckRegistry:
4242
deployment_checks: set[_ProcessedCheckCallable]
4343
def __init__(self) -> None: ...
4444
@overload
45-
def register(self, __check: _C) -> _ProcessedCheckCallable[_C]: ...
45+
def register(self, check: _C, /) -> _ProcessedCheckCallable[_C]: ...
4646
@overload
4747
def register(self, *tags: str, **kwargs: Any) -> Callable[[_C], _ProcessedCheckCallable[_C]]: ...
4848
def run_checks(

django-stubs/core/paginator.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ _T = TypeVar("_T")
1313
@type_check_only
1414
class _SupportsPagination(Protocol[_T], Sized, Iterable):
1515
@overload
16-
def __getitem__(self, __index: int) -> _T: ...
16+
def __getitem__(self, index: int, /) -> _T: ...
1717
@overload
18-
def __getitem__(self, __index: slice) -> _SupportsPagination[_T]: ...
18+
def __getitem__(self, index: slice, /) -> _SupportsPagination[_T]: ...
1919

2020
class Paginator(Generic[_T]):
2121
ELLIPSIS: ClassVar[_StrPromise]

django-stubs/db/backends/ddl_references.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ from typing import Any, Protocol, type_check_only
55
class _QuoteCallable(Protocol):
66
"""Get rid of `cannot assign to method`"""
77

8-
def __call__(self, __column: str) -> str: ...
8+
def __call__(self, column: str, /) -> str: ...
99

1010
class Reference:
1111
def references_table(self, table: Any) -> bool: ...
@@ -40,7 +40,7 @@ class Columns(TableColumns):
4040
class _NameCallable(Protocol):
4141
"""Get rid of `cannot assign to method`"""
4242

43-
def __call__(self, __table: str, __columns: list[str], __suffix: str) -> str: ...
43+
def __call__(self, table: str, columns: list[str], suffix: str, /) -> str: ...
4444

4545
class IndexName(TableColumns):
4646
columns: list[str]

django-stubs/db/migrations/executor.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ from .state import ProjectState
1010

1111
@type_check_only
1212
class _ProgressCallbackT(Protocol):
13-
def __call__(self, __action: str, __migration: Migration | None = ..., __fake: bool | None = ...) -> None: ...
13+
def __call__(self, action: str, migration: Migration | None = ..., fake: bool | None = ..., /) -> None: ...
1414

1515
class MigrationExecutor:
1616
connection: BaseDatabaseWrapper

django-stubs/db/migrations/operations/special.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class RunSQL(Operation):
3737

3838
@type_check_only
3939
class _CodeCallable(Protocol):
40-
def __call__(self, __state_apps: StateApps, __schema_editor: BaseDatabaseSchemaEditor) -> None: ...
40+
def __call__(self, state_apps: StateApps, schema_editor: BaseDatabaseSchemaEditor, /) -> None: ...
4141

4242
class RunPython(Operation):
4343
code: _CodeCallable

django-stubs/db/models/fields/files.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ _M = TypeVar("_M", bound=Model, contravariant=True)
3939

4040
@type_check_only
4141
class _UploadToCallable(Protocol[_M]):
42-
def __call__(self, __instance: _M, __filename: str) -> _PathCompatible: ...
42+
def __call__(self, instance: _M, filename: str, /) -> _PathCompatible: ...
4343

4444
class FileField(Field):
4545
storage: Storage

django-stubs/forms/fields.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ class ChoiceField(Field):
354354

355355
@type_check_only
356356
class _CoerceCallable(Protocol):
357-
def __call__(self, __value: Any) -> Any: ...
357+
def __call__(self, value: Any, /) -> Any: ...
358358

359359
class TypedChoiceField(ChoiceField):
360360
coerce: _CoerceCallable

django-stubs/forms/widgets.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class TimeInput(DateTimeBaseInput):
139139
def boolean_check(v: Any) -> bool: ...
140140
@type_check_only
141141
class _CheckCallable(Protocol):
142-
def __call__(self, __value: Any) -> bool: ...
142+
def __call__(self, value: Any, /) -> bool: ...
143143

144144
class CheckboxInput(Input):
145145
check_test: _CheckCallable

0 commit comments

Comments
 (0)