From a101251a2adbe4c42d28a60732e2b4d505cc624b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20Gro=C3=9F?= Date: Thu, 17 Mar 2016 11:06:47 +0000 Subject: [PATCH] Fix blank lines around docstrings --- rest_framework/decorators.py | 1 - rest_framework/generics.py | 3 --- rest_framework/parsers.py | 5 ----- rest_framework/permissions.py | 2 +- rest_framework/relations.py | 1 - rest_framework/renderers.py | 3 --- rest_framework/request.py | 2 ++ rest_framework/routers.py | 1 - rest_framework/throttling.py | 2 +- rest_framework/utils/breadcrumbs.py | 1 - 10 files changed, 4 insertions(+), 17 deletions(-) diff --git a/rest_framework/decorators.py b/rest_framework/decorators.py index 4c8bda39c8..1b21e643b3 100644 --- a/rest_framework/decorators.py +++ b/rest_framework/decorators.py @@ -16,7 +16,6 @@ def api_view(http_method_names=None): - """ Decorator that converts a function-based view into an APIView subclass. Takes a list of allowed methods for the view as an argument. diff --git a/rest_framework/generics.py b/rest_framework/generics.py index 88438e8c4d..3ee5691093 100644 --- a/rest_framework/generics.py +++ b/rest_framework/generics.py @@ -184,7 +184,6 @@ def get_paginated_response(self, data): class CreateAPIView(mixins.CreateModelMixin, GenericAPIView): - """ Concrete view for creating a model instance. """ @@ -212,7 +211,6 @@ def get(self, request, *args, **kwargs): class DestroyAPIView(mixins.DestroyModelMixin, GenericAPIView): - """ Concrete view for deleting a model instance. """ @@ -222,7 +220,6 @@ def delete(self, request, *args, **kwargs): class UpdateAPIView(mixins.UpdateModelMixin, GenericAPIView): - """ Concrete view for updating a model instance. """ diff --git a/rest_framework/parsers.py b/rest_framework/parsers.py index 95de41c234..ab74a6e58a 100644 --- a/rest_framework/parsers.py +++ b/rest_framework/parsers.py @@ -35,7 +35,6 @@ class BaseParser(object): All parsers should extend `BaseParser`, specifying a `media_type` attribute, and overriding the `.parse()` method. """ - media_type = None def parse(self, stream, media_type=None, parser_context=None): @@ -51,7 +50,6 @@ class JSONParser(BaseParser): """ Parses JSON-serialized data. """ - media_type = 'application/json' renderer_class = renderers.JSONRenderer @@ -73,7 +71,6 @@ class FormParser(BaseParser): """ Parser for form data. """ - media_type = 'application/x-www-form-urlencoded' def parse(self, stream, media_type=None, parser_context=None): @@ -91,7 +88,6 @@ class MultiPartParser(BaseParser): """ Parser for multipart form data, which may include file data. """ - media_type = 'multipart/form-data' def parse(self, stream, media_type=None, parser_context=None): @@ -131,7 +127,6 @@ def parse(self, stream, media_type=None, parser_context=None): `.data` will be None (we expect request body to be a file content). `.files` will be a `QueryDict` containing one 'file' element. """ - parser_context = parser_context or {} request = parser_context['request'] encoding = parser_context.get('encoding', settings.DEFAULT_CHARSET) diff --git a/rest_framework/permissions.py b/rest_framework/permissions.py index 4d5832a7a4..8f5de02569 100644 --- a/rest_framework/permissions.py +++ b/rest_framework/permissions.py @@ -33,6 +33,7 @@ class AllowAny(BasePermission): permission_classes list, but it's useful because it makes the intention more explicit. """ + def has_permission(self, request, view): return True @@ -150,7 +151,6 @@ class DjangoObjectPermissions(DjangoModelPermissions): This permission can only be applied against view classes that provide a `.queryset` attribute. """ - perms_map = { 'GET': [], 'OPTIONS': [], diff --git a/rest_framework/relations.py b/rest_framework/relations.py index 2b7906a593..572b691709 100644 --- a/rest_framework/relations.py +++ b/rest_framework/relations.py @@ -397,7 +397,6 @@ class SlugRelatedField(RelatedField): A read-write field that represents the target of the relationship by a unique 'slug' attribute. """ - default_error_messages = { 'does_not_exist': _('Object with {slug_name}={value} does not exist.'), 'invalid': _('Invalid value.'), diff --git a/rest_framework/renderers.py b/rest_framework/renderers.py index 024f0eb8ba..68af417dad 100644 --- a/rest_framework/renderers.py +++ b/rest_framework/renderers.py @@ -40,7 +40,6 @@ class BaseRenderer(object): All renderers should extend this class, setting the `media_type` and `format` attributes, and override the `.render()` method. """ - media_type = None format = None charset = 'utf-8' @@ -54,7 +53,6 @@ class JSONRenderer(BaseRenderer): """ Renderer which serializes to JSON. """ - media_type = 'application/json' format = 'json' encoder_class = encoders.JSONEncoder @@ -136,7 +134,6 @@ class TemplateHTMLRenderer(BaseRenderer): For pre-rendered HTML, see StaticHTMLRenderer. """ - media_type = 'text/html' format = 'html' template_name = None diff --git a/rest_framework/request.py b/rest_framework/request.py index 846cadcd9e..aafafcb325 100644 --- a/rest_framework/request.py +++ b/rest_framework/request.py @@ -41,6 +41,7 @@ class override_method(object): with override_method(view, request, 'POST') as request: ... # Do stuff with `view` and `request` """ + def __init__(self, view, request, method): self.view = view self.request = request @@ -129,6 +130,7 @@ class Request(object): - authentication_classes(list/tuple). The authentications used to try authenticating the request's user. """ + def __init__(self, request, parsers=None, authenticators=None, negotiator=None, parser_context=None): self._request = request diff --git a/rest_framework/routers.py b/rest_framework/routers.py index 39605923d9..027a78cc13 100644 --- a/rest_framework/routers.py +++ b/rest_framework/routers.py @@ -144,7 +144,6 @@ def get_routes(self, viewset): Returns a list of the Route namedtuple. """ - known_actions = flatten([route.mapping.values() for route in self.routes if isinstance(route, Route)]) # Determine any `@detail_route` or `@list_route` decorated methods on the viewset diff --git a/rest_framework/throttling.py b/rest_framework/throttling.py index abb3534693..1449f501b8 100644 --- a/rest_framework/throttling.py +++ b/rest_framework/throttling.py @@ -15,6 +15,7 @@ class BaseThrottle(object): """ Rate throttling of requests. """ + def allow_request(self, request, view): """ Return `True` if the request should be allowed, `False` otherwise. @@ -60,7 +61,6 @@ class SimpleRateThrottle(BaseThrottle): Previous request information used for throttling is stored in the cache. """ - cache = default_cache timer = time.time cache_format = 'throttle_%(scope)s_%(ident)s' diff --git a/rest_framework/utils/breadcrumbs.py b/rest_framework/utils/breadcrumbs.py index 950e9695b8..b7593c25f8 100644 --- a/rest_framework/utils/breadcrumbs.py +++ b/rest_framework/utils/breadcrumbs.py @@ -19,7 +19,6 @@ def breadcrumbs_recursive(url, breadcrumbs_list, prefix, seen): Add tuples of (name, url) to the breadcrumbs list, progressively chomping off parts of the url. """ - try: (view, unused_args, unused_kwargs) = resolve(url) except Exception: