Skip to content

Commit eca2c1f

Browse files
kaedrohorpkilby
andauthored
Python 2 cleanups (#1186)
* Remove explicit inheritance from `object` * Use argumentless super() syntax Co-authored-by: Ryan P Kilby <[email protected]>
1 parent 1880430 commit eca2c1f

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

django_filters/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def is_callable(value):
6565
return callable(value) and not isinstance(value, type)
6666

6767

68-
class Settings(object):
68+
class Settings:
6969

7070
def __getattr__(self, name):
7171
if name not in DEFAULTS:

django_filters/fields.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def clean(self, value):
211211
return value
212212

213213

214-
class ChoiceIterator(object):
214+
class ChoiceIterator:
215215
# Emulates the behavior of ModelChoiceIterator, but instead wraps
216216
# the field's _choices iterable.
217217

@@ -257,7 +257,7 @@ def __len__(self):
257257
return super().__len__() + add
258258

259259

260-
class ChoiceIteratorMixin(object):
260+
class ChoiceIteratorMixin:
261261
def __init__(self, *args, **kwargs):
262262
self.null_label = kwargs.pop('null_label', settings.NULL_CHOICE_LABEL)
263263
self.null_value = kwargs.pop('null_value', settings.NULL_CHOICE_VALUE)

django_filters/filters.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
]
6363

6464

65-
class Filter(object):
65+
class Filter:
6666
creation_counter = 0
6767
field_class = forms.Field
6868

@@ -291,7 +291,7 @@ class DurationFilter(Filter):
291291
field_class = forms.DurationField
292292

293293

294-
class QuerySetRequestMixin(object):
294+
class QuerySetRequestMixin:
295295
"""
296296
Add callable functionality to filters that support the ``queryset``
297297
argument. If the ``queryset`` is callable, then it **must** accept the
@@ -642,10 +642,10 @@ def field(self):
642642

643643
def filter(self, qs, lookup):
644644
if not lookup:
645-
return super(LookupChoiceFilter, self).filter(qs, None)
645+
return super().filter(qs, None)
646646

647647
self.lookup_expr = lookup.lookup_expr
648-
return super(LookupChoiceFilter, self).filter(qs, lookup.value)
648+
return super().filter(qs, lookup.value)
649649

650650

651651
class OrderingFilter(BaseCSVFilter, ChoiceFilter):
@@ -746,7 +746,7 @@ def build_choices(self, fields, labels):
746746
return [val for pair in zip(ascending, descending) for val in pair]
747747

748748

749-
class FilterMethod(object):
749+
class FilterMethod:
750750
"""
751751
This helper is used to override Filter.filter() when a 'method' argument
752752
is passed. It proxies the call to the actual method on the filter's parent.

django_filters/filterset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def remote_queryset(field):
5151
return model._default_manager.complex_filter(limit_choices_to)
5252

5353

54-
class FilterSetOptions(object):
54+
class FilterSetOptions:
5555
def __init__(self, options=None):
5656
self.model = getattr(options, 'model', None)
5757
self.fields = getattr(options, 'fields', None)
@@ -184,7 +184,7 @@ def visit(name):
184184
}
185185

186186

187-
class BaseFilterSet(object):
187+
class BaseFilterSet:
188188
FILTER_DEFAULTS = FILTER_FOR_DBFIELD_DEFAULTS
189189

190190
def __init__(self, data=None, queryset=None, *, request=None, prefix=None):

tests/test_conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def test_behavior(self):
8080
def func():
8181
pass
8282

83-
class Class(object):
83+
class Class:
8484
def __call__(self):
8585
pass
8686

0 commit comments

Comments
 (0)