Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Oct 20, 2023
1 parent 013f326 commit 4d52cd5
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 76 deletions.
4 changes: 1 addition & 3 deletions stubs/django-filter/conf.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ def is_callable(value: Any): ...
class Settings:
def __getattr__(self, name: Any): ...
def get_setting(self, setting: Any): ...
def change_setting(
self, setting: Any, value: Any, enter: Any, **kwargs: Any
) -> None: ...
def change_setting(self, setting: Any, value: Any, enter: Any, **kwargs: Any) -> None: ...

settings: Any
20 changes: 9 additions & 11 deletions stubs/django-filter/fields.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ from django import forms
from .conf import settings as settings
from .constants import EMPTY_VALUES as EMPTY_VALUES
from .utils import handle_timezone as handle_timezone
from .widgets import BaseCSVWidget as BaseCSVWidget
from .widgets import CSVWidget as CSVWidget
from .widgets import DateRangeWidget as DateRangeWidget
from .widgets import LookupChoiceWidget as LookupChoiceWidget
from .widgets import RangeWidget as RangeWidget
from .widgets import (
BaseCSVWidget as BaseCSVWidget,
CSVWidget as CSVWidget,
DateRangeWidget as DateRangeWidget,
LookupChoiceWidget as LookupChoiceWidget,
RangeWidget as RangeWidget,
)

class RangeField(forms.MultiValueField):
widget: Any = ...
def __init__(
self, fields: Optional[Any] = ..., *args: Any, **kwargs: Any
) -> None: ...
def __init__(self, fields: Optional[Any] = ..., *args: Any, **kwargs: Any) -> None: ...
def compress(self, data_list: Any): ...

class DateRangeField(RangeField):
Expand All @@ -40,9 +40,7 @@ class Lookup:

class LookupChoiceField(forms.MultiValueField):
default_error_messages: Any = ...
def __init__(
self, field: Any, lookup_choices: Any, *args: Any, **kwargs: Any
) -> None: ...
def __init__(self, field: Any, lookup_choices: Any, *args: Any, **kwargs: Any) -> None: ...
def compress(self, data_list: Any): ...

class IsoDateTimeField(forms.DateTimeField):
Expand Down
12 changes: 3 additions & 9 deletions stubs/django-filter/filters.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Filter:
method: Optional[Any] = ...,
distinct: bool = ...,
exclude: bool = ...,
**kwargs: Any
**kwargs: Any,
) -> None: ...
def get_method(self, qs: Any): ...
method: Callable = ...

Check failure on line 23 in stubs/django-filter/filters.pyi

View workflow job for this annotation

GitHub Actions / Test typeshed with pyright (Linux, 3.11)

Expected type arguments for generic class "Callable" (reportMissingTypeArgument)
Expand Down Expand Up @@ -103,13 +103,7 @@ class RangeFilter(Filter):
class DateRangeFilter(ChoiceFilter):
choices: Any = ...
filters: Any = ...
def __init__(
self,
choices: Optional[Any] = ...,
filters: Optional[Any] = ...,
*args: Any,
**kwargs: Any
) -> None: ...
def __init__(self, choices: Optional[Any] = ..., filters: Optional[Any] = ..., *args: Any, **kwargs: Any) -> None: ...
def filter(self, qs: Any, value: Any): ...

class DateFromToRangeFilter(RangeFilter):
Expand Down Expand Up @@ -154,7 +148,7 @@ class LookupChoiceFilter(Filter):
field_name: Optional[Any] = ...,
lookup_choices: Optional[Any] = ...,
field_class: Optional[Any] = ...,
**kwargs: Any
**kwargs: Any,
) -> None: ...
@classmethod
def normalize_lookup(cls, lookup: Any): ...
Expand Down
21 changes: 1 addition & 20 deletions stubs/django-filter/filterset.pyi
Original file line number Diff line number Diff line change
@@ -1,24 +1,5 @@
from typing import Any, Optional

from .conf import settings
from .constants import ALL_FIELDS
from .filters import (
BaseInFilter,
BaseRangeFilter,
BooleanFilter,
CharFilter,
ChoiceFilter,
DateFilter,
DateTimeFilter,
DurationFilter,
Filter,
ModelChoiceFilter,
ModelMultipleChoiceFilter,
NumberFilter,
TimeFilter,
UUIDFilter,
)
from .utils import get_all_model_fields, get_model_field, resolve_field, try_dbfield

def remote_queryset(field: Any): ...

Expand Down Expand Up @@ -51,7 +32,7 @@ class BaseFilterSet:
queryset: Optional[Any] = ...,
*,
request: Optional[Any] = ...,
prefix: Optional[Any] = ...
prefix: Optional[Any] = ...,
) -> None: ...
def is_valid(self): ...
@property
Expand Down
6 changes: 2 additions & 4 deletions stubs/django-filter/rest_framework/backends.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ from typing import Any, Optional

from django.utils.deprecation import RenameMethodsBase

from .. import compat as compat
from .. import utils as utils
from . import filters as filters
from . import filterset as filterset
from .. import compat as compat, utils as utils
from . import filters as filters, filterset as filterset

class RenameAttributes(utils.RenameAttributesBase, RenameMethodsBase):
renamed_attributes: Any = ...
Expand Down
4 changes: 1 addition & 3 deletions stubs/django-filter/utils.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,5 @@ def resolve_field(model_field: Any, lookup_expr: Any): ...
def handle_timezone(value: Any, is_dst: Optional[Any] = ...): ...
def verbose_field_name(model: Any, field_name: Any): ...
def verbose_lookup_expr(lookup_expr: Any): ...
def label_for_filter(
model: Any, field_name: Any, lookup_expr: Any, exclude: bool = ...
): ...
def label_for_filter(model: Any, field_name: Any, lookup_expr: Any, exclude: bool = ...): ...
def translate_validation(error_dict: Any): ...
8 changes: 2 additions & 6 deletions stubs/django-filter/views.pyi
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
from typing import Any, Optional

from django.views.generic import View
from django.views.generic.list import (
MultipleObjectMixin,
MultipleObjectTemplateResponseMixin,
)
from django.views.generic.list import MultipleObjectMixin, MultipleObjectTemplateResponseMixin

from .constants import ALL_FIELDS as ALL_FIELDS
from .filterset import filterset_factory as filterset_factory
from .utils import MigrationNotice as MigrationNotice
from .utils import RenameAttributesBase as RenameAttributesBase
from .utils import MigrationNotice as MigrationNotice, RenameAttributesBase as RenameAttributesBase

class FilterMixinRenames(RenameAttributesBase):
renamed_attributes: Any = ...
Expand Down
26 changes: 6 additions & 20 deletions stubs/django-filter/widgets.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import Any, Dict, Optional, Tuple
from typing import Any, Optional

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

_OptAttrs = Dict[str, Any]
_OptAttrs = dict[str, Any]

class LinkWidget(forms.Widget):
choices: Any = ...
Expand All @@ -16,13 +16,11 @@ class LinkWidget(forms.Widget):
name: str,
value: Any,
attrs: Optional[_OptAttrs] = ...,
choices: Tuple = ...,
choices: tuple = ...,

Check failure on line 19 in stubs/django-filter/widgets.pyi

View workflow job for this annotation

GitHub Actions / Test typeshed with pyright (Linux, 3.11)

Expected type arguments for generic class "tuple" (reportMissingTypeArgument)
renderer: Optional[BaseRenderer] = ...,
) -> 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
): ...
def render_option(self, name: Any, selected_choices: Any, option_value: Any, option_label: Any): ...
def option_string(self): ...

class SuffixedMultiWidget(forms.MultiWidget):
Expand Down Expand Up @@ -50,24 +48,12 @@ class LookupChoiceWidget(SuffixedMultiWidget):

class BooleanWidget(forms.Select):
def __init__(self, attrs: Optional[Any] = ...) -> None: ...
def render(
self,
name: Any,
value: Any,
attrs: Optional[Any] = ...,
renderer: Optional[Any] = ...,
): ...
def render(self, name: Any, value: Any, attrs: Optional[Any] = ..., renderer: Optional[Any] = ...): ...
def value_from_datadict(self, data: Any, files: Any, name: Any): ...

class BaseCSVWidget(forms.Widget):
def value_from_datadict(self, data: Any, files: Any, name: Any): ...
def render(
self,
name: Any,
value: Any,
attrs: Optional[Any] = ...,
renderer: Optional[Any] = ...,
): ...
def render(self, name: Any, value: Any, attrs: Optional[Any] = ..., renderer: Optional[Any] = ...): ...

class CSVWidget(BaseCSVWidget, forms.TextInput): ...

Expand Down

0 comments on commit 4d52cd5

Please sign in to comment.