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

chore: add some missing generic types #1717

Merged
merged 1 commit into from
Sep 17, 2023
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
5 changes: 3 additions & 2 deletions django-stubs/contrib/auth/admin.pyi
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
from typing import Any

from django.contrib import admin
from django.contrib.auth.models import Group, User
from django.http.request import HttpRequest
from django.http.response import HttpResponse

csrf_protect_m: Any
sensitive_post_parameters_m: Any

class GroupAdmin(admin.ModelAdmin): ...
class GroupAdmin(admin.ModelAdmin[Group]): ...

class UserAdmin(admin.ModelAdmin):
class UserAdmin(admin.ModelAdmin[User]):
change_user_password_template: Any
add_fieldsets: Any
add_form: Any
Expand Down
3 changes: 2 additions & 1 deletion django-stubs/contrib/flatpages/admin.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from typing import Any

from django.contrib import admin
from django.contrib.flatpages.models import FlatPage

class FlatPageAdmin(admin.ModelAdmin):
class FlatPageAdmin(admin.ModelAdmin[FlatPage]):
form: Any
fieldsets: Any
list_display: Any
Expand Down
2 changes: 1 addition & 1 deletion django-stubs/template/loader_tags.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ register: Any
BLOCK_CONTEXT_KEY: str

class BlockContext:
blocks: collections.defaultdict
blocks: collections.defaultdict[str, list[BlockNode]]
def __init__(self) -> None: ...
def add_blocks(self, blocks: dict[str, BlockNode]) -> None: ...
def pop(self, name: str) -> BlockNode: ...
Expand Down
3 changes: 2 additions & 1 deletion django-stubs/utils/feedgenerator.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime
from collections.abc import Sequence
from typing import Any

from django.utils.xmlutils import SimplerXMLGenerator
Expand Down Expand Up @@ -40,7 +41,7 @@ class SyndicationFeed:
comments: str | None = ...,
unique_id: str | None = ...,
unique_id_is_permalink: bool | None = ...,
categories: tuple | None = ...,
categories: Sequence[str | None] | None = ...,
item_copyright: str | None = ...,
ttl: int | None = ...,
updateddate: datetime.datetime | None = ...,
Expand Down
4 changes: 2 additions & 2 deletions django-stubs/utils/log.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class AdminEmailHandler(logging.Handler):
def format_subject(self, subject: str) -> str: ...

class CallbackFilter(logging.Filter):
callback: Callable
def __init__(self, callback: Callable) -> None: ...
callback: Callable[[str | LogRecord], bool]
def __init__(self, callback: Callable[[str | LogRecord], bool]) -> None: ...
def filter(self, record: str | LogRecord) -> bool: ...

class RequireDebugFalse(logging.Filter):
Expand Down