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

Explicitly export all the filters from the rest_framework module #18

Merged
merged 2 commits into from
Mar 28, 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
35 changes: 35 additions & 0 deletions django_filters-stubs/rest_framework/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
from .backends import DjangoFilterBackend as DjangoFilterBackend
from .filters import *
from .filterset import FilterSet as FilterSet

__all__ = [
"DjangoFilterBackend",
"FilterSet",
"BooleanFilter",
"AllValuesFilter",
"AllValuesMultipleFilter",
"BaseCSVFilter",
"BaseInFilter",
"BaseRangeFilter",
"CharFilter",
"ChoiceFilter",
"DateFilter",
"DateFromToRangeFilter",
"DateRangeFilter",
"DateTimeFilter",
"DateTimeFromToRangeFilter",
"DurationFilter",
"Filter",
"IsoDateTimeFilter",
"IsoDateTimeFromToRangeFilter",
"LookupChoiceFilter",
"ModelChoiceFilter",
"ModelMultipleChoiceFilter",
"MultipleChoiceFilter",
"NumberFilter",
"NumericRangeFilter",
"OrderingFilter",
"RangeFilter",
"TimeFilter",
"TimeRangeFilter",
"TypedChoiceFilter",
"TypedMultipleChoiceFilter",
"UUIDFilter",
]
95 changes: 64 additions & 31 deletions django_filters-stubs/rest_framework/filters.pyi
Original file line number Diff line number Diff line change
@@ -1,37 +1,70 @@
from typing import Any

from django_filters import filters
from django_filters import (
AllValuesFilter,
AllValuesMultipleFilter,
BaseCSVFilter,
BaseInFilter,
BaseRangeFilter,
CharFilter,
ChoiceFilter,
DateFilter,
DateFromToRangeFilter,
DateRangeFilter,
DateTimeFilter,
DateTimeFromToRangeFilter,
DurationFilter,
Filter,
IsoDateTimeFilter,
IsoDateTimeFromToRangeFilter,
LookupChoiceFilter,
ModelChoiceFilter,
ModelMultipleChoiceFilter,
MultipleChoiceFilter,
NumberFilter,
NumericRangeFilter,
OrderingFilter,
RangeFilter,
TimeFilter,
TimeRangeFilter,
TypedChoiceFilter,
TypedMultipleChoiceFilter,
UUIDFilter,
filters,
)

class BooleanFilter(filters.BooleanFilter):
def __init__(self, *args: Any, **kwargs: Any) -> None: ...

# Names in __all__ with no definition:
# AllValuesFilter
# AllValuesMultipleFilter
# BaseCSVFilter
# BaseInFilter
# BaseRangeFilter
# CharFilter
# ChoiceFilter
# DateFilter
# DateFromToRangeFilter
# DateRangeFilter
# DateTimeFilter
# DateTimeFromToRangeFilter
# DurationFilter
# Filter
# IsoDateTimeFilter
# IsoDateTimeFromToRangeFilter
# LookupChoiceFilter
# ModelChoiceFilter
# ModelMultipleChoiceFilter
# MultipleChoiceFilter
# NumberFilter
# NumericRangeFilter
# OrderingFilter
# RangeFilter
# TimeFilter
# TimeRangeFilter
# TypedChoiceFilter
# TypedMultipleChoiceFilter
# UUIDFilter
__all__ = [
"BooleanFilter",
"AllValuesFilter",
"AllValuesMultipleFilter",
"BaseCSVFilter",
"BaseInFilter",
"BaseRangeFilter",
"CharFilter",
"ChoiceFilter",
"DateFilter",
"DateFromToRangeFilter",
"DateRangeFilter",
"DateTimeFilter",
"DateTimeFromToRangeFilter",
"DurationFilter",
"Filter",
"IsoDateTimeFilter",
"IsoDateTimeFromToRangeFilter",
"LookupChoiceFilter",
"ModelChoiceFilter",
"ModelMultipleChoiceFilter",
"MultipleChoiceFilter",
"NumberFilter",
"NumericRangeFilter",
"OrderingFilter",
"RangeFilter",
"TimeFilter",
"TimeRangeFilter",
"TypedChoiceFilter",
"TypedMultipleChoiceFilter",
"UUIDFilter",
]
6 changes: 6 additions & 0 deletions tests/test_rest_framework.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- case: rest_framework
main: |
from django_filters import rest_framework as filters

class TestFilter(filters.FilterSet):
special_date = filters.DateFilter() # Mypy: Module has no attribute "DateFilter" [attr-defined]