Skip to content

Commit b032a3d

Browse files
author
Kacper Szmigiel
committed
update stubs to master version
1 parent dabdfa1 commit b032a3d

File tree

6 files changed

+21
-8
lines changed

6 files changed

+21
-8
lines changed

django-stubs/contrib/admin/options.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class ModelAdmin(BaseModelAdmin):
135135
delete_selected_confirmation_template: str = ...
136136
object_history_template: str = ...
137137
popup_response_template: str = ...
138-
actions: Sequence[Callable[[ModelAdmin, HttpRequest, QuerySet], None]] = ...
138+
actions: Sequence[Union[Callable[[ModelAdmin, HttpRequest, QuerySet], None], str]] = ...
139139
action_form: Any = ...
140140
actions_on_top: bool = ...
141141
actions_on_bottom: bool = ...

django-stubs/core/paginator.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class Paginator:
2929
orphans: int = ...,
3030
allow_empty_first_page: bool = ...,
3131
) -> None: ...
32-
def validate_number(self, number: Optional[Union[float, str]]) -> int: ...
33-
def get_page(self, number: Optional[int]) -> Page: ...
32+
def validate_number(self, number: Optional[Union[int, float, str]]) -> int: ...
33+
def get_page(self, number: Optional[Union[int, float, str]]) -> Page: ...
3434
def page(self, number: Union[int, str]) -> Page: ...
3535
@property
3636
def count(self) -> int: ...

django-stubs/db/models/enums.pyi

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ class ChoicesMeta(enum.EnumMeta):
1010

1111
class Choices(enum.Enum, metaclass=ChoicesMeta):
1212
def __str__(self): ...
13+
@property
14+
def label(self) -> str: ...
15+
@property
16+
def value(self) -> Any: ...
1317

1418
# fake
1519
class _IntegerChoicesMeta(ChoicesMeta):
@@ -18,7 +22,9 @@ class _IntegerChoicesMeta(ChoicesMeta):
1822
labels: List[str] = ...
1923
values: List[int] = ...
2024

21-
class IntegerChoices(int, Choices, metaclass=_IntegerChoicesMeta): ...
25+
class IntegerChoices(int, Choices, metaclass=_IntegerChoicesMeta):
26+
@property
27+
def value(self) -> int: ...
2228

2329
# fake
2430
class _TextChoicesMeta(ChoicesMeta):
@@ -27,4 +33,6 @@ class _TextChoicesMeta(ChoicesMeta):
2733
labels: List[str] = ...
2834
values: List[str] = ...
2935

30-
class TextChoices(str, Choices, metaclass=_TextChoicesMeta): ...
36+
class TextChoices(str, Choices, metaclass=_TextChoicesMeta):
37+
@property
38+
def value(self) -> str: ...

django-stubs/forms/fields.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Field:
1414
initial: Any
1515
label: Optional[str]
1616
required: bool
17-
widget: Type[Widget] = ...
17+
widget: Union[Type[Widget], Widget] = ...
1818
hidden_widget: Any = ...
1919
default_validators: Any = ...
2020
default_error_messages: Any = ...

django-stubs/http/response.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,13 @@ class HttpResponse(HttpResponseBase):
8383
context: Context
8484
resolver_match: ResolverMatch
8585
def json(self) -> Any: ...
86+
def getvalue(self) -> bytes: ...
8687

8788
class StreamingHttpResponse(HttpResponseBase):
8889
content: Any
8990
streaming_content: Iterator[Any]
9091
def __init__(self, streaming_content: Iterable[Any] = ..., *args: Any, **kwargs: Any) -> None: ...
91-
def getvalue(self) -> Any: ...
92+
def getvalue(self) -> bytes: ...
9293

9394
class FileResponse(StreamingHttpResponse):
9495
client: Client

django-stubs/utils/functional.pyi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,8 @@ class SimpleLazyObject(LazyObject):
5656
def __copy__(self) -> List[int]: ...
5757
def __deepcopy__(self, memo: Dict[Any, Any]) -> List[int]: ...
5858

59-
def partition(predicate: Callable, values: List[Model]) -> Tuple[List[Model], List[Model]]: ...
59+
_PartitionMember = TypeVar("_PartitionMember")
60+
61+
def partition(
62+
predicate: Callable, values: List[_PartitionMember]
63+
) -> Tuple[List[_PartitionMember], List[_PartitionMember]]: ...

0 commit comments

Comments
 (0)