Skip to content

Commit 380ac8e

Browse files
authored
Remove old-style super calls (encode#8226)
1 parent 580bf45 commit 380ac8e

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

docs/api-guide/filtering.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ To dynamically change search fields based on request content, it's possible to s
241241
def get_search_fields(self, view, request):
242242
if request.query_params.get('title_only'):
243243
return ['title']
244-
return super(CustomSearchFilter, self).get_search_fields(view, request)
244+
return super().get_search_fields(view, request)
245245

246246
For more details, see the [Django documentation][search-django-admin].
247247

docs/api-guide/serializers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ For example, if you wanted to be able to set which fields should be used by a se
10951095
fields = kwargs.pop('fields', None)
10961096

10971097
# Instantiate the superclass normally
1098-
super(DynamicFieldsModelSerializer, self).__init__(*args, **kwargs)
1098+
super().__init__(*args, **kwargs)
10991099

11001100
if fields is not None:
11011101
# Drop any fields that are not specified in the `fields` argument.

docs/tutorial/4-authentication-and-permissions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ And now we can add a `.save()` method to our model class:
3838
formatter = HtmlFormatter(style=self.style, linenos=linenos,
3939
full=True, **options)
4040
self.highlighted = highlight(self.code, lexer, formatter)
41-
super(Snippet, self).save(*args, **kwargs)
41+
super().save(*args, **kwargs)
4242

4343
When that's all done we'll need to update our database tables.
4444
Normally we'd create a database migration in order to do that, but for the purposes of this tutorial, let's just delete the database and start again.

rest_framework/fields.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,6 +1491,8 @@ def to_internal_value(self, data):
14911491
self.fail('empty')
14921492

14931493
return {
1494+
# Arguments for super() are needed because of scoping inside
1495+
# comprehensions.
14941496
super(MultipleChoiceField, self).to_internal_value(item)
14951497
for item in data
14961498
}

rest_framework/schemas/coreapi.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class LinkNode(OrderedDict):
5858
def __init__(self):
5959
self.links = []
6060
self.methods_counter = Counter()
61-
super(LinkNode, self).__init__()
61+
super().__init__()
6262

6363
def get_available_key(self, preferred_key):
6464
if preferred_key not in self:
@@ -120,7 +120,7 @@ def __init__(self, title=None, url=None, description=None, patterns=None, urlcon
120120
assert coreapi, '`coreapi` must be installed for schema support.'
121121
assert coreschema, '`coreschema` must be installed for schema support.'
122122

123-
super(SchemaGenerator, self).__init__(title, url, description, patterns, urlconf)
123+
super().__init__(title, url, description, patterns, urlconf)
124124
self.coerce_method_names = api_settings.SCHEMA_COERCE_METHOD_NAMES
125125

126126
def get_links(self, request=None):
@@ -346,7 +346,7 @@ def __init__(self, manual_fields=None):
346346
* `manual_fields`: list of `coreapi.Field` instances that
347347
will be added to auto-generated fields, overwriting on `Field.name`
348348
"""
349-
super(AutoSchema, self).__init__()
349+
super().__init__()
350350
if manual_fields is None:
351351
manual_fields = []
352352
self._manual_fields = manual_fields
@@ -587,7 +587,7 @@ def __init__(self, fields, description='', encoding=None):
587587
* `fields`: list of `coreapi.Field` instances.
588588
* `description`: String description for view. Optional.
589589
"""
590-
super(ManualSchema, self).__init__()
590+
super().__init__()
591591
assert all(isinstance(f, coreapi.Field) for f in fields), "`fields` must be a list of coreapi.Field instances"
592592
self._fields = fields
593593
self._description = description

0 commit comments

Comments
 (0)