Skip to content

Commit

Permalink
[django-filter] Various minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
intgr committed Oct 22, 2023
1 parent 9548106 commit 1549268
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
1 change: 0 additions & 1 deletion stubs/django-filter/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ django_filters.filters.NumberFilter.get_max_validator
django_filters.filterset.BaseFilterSet.filter_for_field
django_filters.filterset.FilterSet.base_filters
django_filters.filterset.FilterSet.declared_filters
django_filters.models
django_filters.rest_framework.DjangoFilterBackend
django_filters.rest_framework.Filter.__init__
django_filters.rest_framework.FilterSet.base_filters
Expand Down
6 changes: 4 additions & 2 deletions stubs/django-filter/django_filters/filters.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from typing import Any, Callable
from _typeshed import Incomplete
from collections.abc import Callable
from typing import Any

class Filter:
creation_counter: int = ...
Expand All @@ -20,7 +22,7 @@ class Filter:
**kwargs: Any,
) -> None: ...
def get_method(self, qs: Any): ...
method: Callable = ...
method: Callable[..., Incomplete] = ...
label: Any = ...
@property
def field(self): ...
Expand Down
Empty file.
3 changes: 2 additions & 1 deletion stubs/django-filter/django_filters/views.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Any

from django.views.generic import View
Expand All @@ -19,7 +20,7 @@ class FilterMixin(metaclass=FilterMixinRenames):
def get_filterset_kwargs(self, filterset_class: Any): ...
def get_strict(self): ...

class BaseFilterView(FilterMixin, MultipleObjectMixin, View):
class BaseFilterView(FilterMixin, MultipleObjectMixin[Incomplete], View):
filterset: Any = ...
object_list: Any = ...
def get(self, request: Any, *args: Any, **kwargs: Any): ...
Expand Down
11 changes: 9 additions & 2 deletions stubs/django-filter/django_filters/widgets.pyi
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
from _typeshed import Incomplete
from typing import Any
from typing_extensions import TypeAlias

from django import forms
from django.forms.renderers import BaseRenderer
from django.utils.safestring import SafeText

_OptAttrs = dict[str, Any]
_OptAttrs: TypeAlias = dict[str, Any]

class LinkWidget(forms.Widget):
choices: Any = ...
def __init__(self, attrs: Any | None = ..., choices: Any = ...) -> None: ...
data: Any = ...
def value_from_datadict(self, data: Any, files: Any, name: Any): ...
def render( # type: ignore[override]
self, name: str, value: Any, attrs: _OptAttrs | None = ..., choices: tuple = ..., renderer: BaseRenderer | None = ...
self,
name: str,
value: Any,
attrs: _OptAttrs | None = ...,
choices: tuple[Incomplete, ...] = ...,
renderer: BaseRenderer | None = ...,
) -> SafeText: ...
def render_options(self, choices: Any, selected_choices: Any, name: Any): ...
def render_option(self, name: Any, selected_choices: Any, option_value: Any, option_label: Any): ...
Expand Down

0 comments on commit 1549268

Please sign in to comment.