From fccfdd21c078579bb0029db7289d5e19d58201e8 Mon Sep 17 00:00:00 2001 From: johnthagen Date: Wed, 13 May 2020 20:54:46 -0400 Subject: [PATCH] Remove object inheritance in docs (#7332) --- docs/api-guide/fields.md | 2 +- docs/api-guide/generic-views.md | 2 +- docs/api-guide/serializers.md | 2 +- docs/api-guide/validators.md | 2 +- rest_framework/schemas/generators.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/api-guide/fields.md b/docs/api-guide/fields.md index 65c83b78e..b2bdd50c8 100644 --- a/docs/api-guide/fields.md +++ b/docs/api-guide/fields.md @@ -603,7 +603,7 @@ The `to_internal_value()` method is called to restore a primitive datatype into Let's look at an example of serializing a class that represents an RGB color value: - class Color(object): + class Color: """ A color represented in the RGB colorspace. """ diff --git a/docs/api-guide/generic-views.md b/docs/api-guide/generic-views.md index a256eb2d9..4ff549f07 100644 --- a/docs/api-guide/generic-views.md +++ b/docs/api-guide/generic-views.md @@ -319,7 +319,7 @@ Often you'll want to use the existing generic views, but use some slightly custo For example, if you need to lookup objects based on multiple fields in the URL conf, you could create a mixin class like the following: - class MultipleFieldLookupMixin(object): + class MultipleFieldLookupMixin: """ Apply this mixin to any view or viewset to get multiple field filtering based on a `lookup_fields` attribute, instead of the default single field filtering. diff --git a/docs/api-guide/serializers.md b/docs/api-guide/serializers.md index 87d3d4056..4f566ff59 100644 --- a/docs/api-guide/serializers.md +++ b/docs/api-guide/serializers.md @@ -21,7 +21,7 @@ Let's start by creating a simple object we can use for example purposes: from datetime import datetime - class Comment(object): + class Comment: def __init__(self, email, content, created=None): self.email = email self.content = content diff --git a/docs/api-guide/validators.md b/docs/api-guide/validators.md index 009cd2468..4451489d4 100644 --- a/docs/api-guide/validators.md +++ b/docs/api-guide/validators.md @@ -282,7 +282,7 @@ to your `Serializer` subclass. This is documented in the To write a class-based validator, use the `__call__` method. Class-based validators are useful as they allow you to parameterize and reuse behavior. - class MultipleOf(object): + class MultipleOf: def __init__(self, base): self.base = base diff --git a/rest_framework/schemas/generators.py b/rest_framework/schemas/generators.py index 4b6d82a14..77502d028 100644 --- a/rest_framework/schemas/generators.py +++ b/rest_framework/schemas/generators.py @@ -143,7 +143,7 @@ class EndpointEnumerator: return [method for method in methods if method not in ('OPTIONS', 'HEAD')] -class BaseSchemaGenerator(object): +class BaseSchemaGenerator: endpoint_inspector_cls = EndpointEnumerator # 'pk' isn't great as an externally exposed name for an identifier,