From f9c67f04d408365704cbb98590cc7348a9f07120 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Thu, 9 Nov 2017 11:57:53 -0800 Subject: [PATCH] Clean up all whitespace throughout project (#5578) * Remove trailing whitespace from lines * Remove trailing nad leading whitespace from files Allows for cleaner diffs in future changes. For editors that automatically clean up whitespace on save, will avoid unrelated line changes in diffs. --- .editorconfig | 7 +++++++ .gitignore | 1 + .tx/config | 1 - docs/api-guide/caching.md | 8 ++++---- docs/api-guide/generic-views.md | 6 +++--- docs/api-guide/permissions.md | 6 +++--- docs/api-guide/routers.md | 12 ++++++------ docs/api-guide/schemas.md | 1 - docs/api-guide/validators.md | 2 +- docs/topics/3.7-announcement.md | 1 - docs/topics/browser-enhancements.md | 2 +- docs/topics/html-and-forms.md | 4 ++-- docs/topics/jobs.md | 2 +- rest_framework/compat.py | 1 - rest_framework/static/rest_framework/css/default.css | 1 - .../docs/fonts/fontawesome-webfont.svg | 2 +- .../docs/fonts/glyphicons-halflings-regular.svg | 2 +- .../fonts/glyphicons-halflings-regular.svg | 2 +- .../templates/rest_framework/docs/error.html | 4 ---- .../rest_framework/docs/langs/javascript-intro.html | 1 - tests/importable/__init__.py | 1 - tests/importable/test_installed.py | 1 - 22 files changed, 32 insertions(+), 36 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..f999431de --- /dev/null +++ b/.editorconfig @@ -0,0 +1,7 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.gitignore b/.gitignore index 41768084c..70b55a094 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ MANIFEST coverage.* +!.editorconfig !.gitignore !.travis.yml !.isort.cfg diff --git a/.tx/config b/.tx/config index dea9db7c9..e151a7e6f 100644 --- a/.tx/config +++ b/.tx/config @@ -7,4 +7,3 @@ file_filter = rest_framework/locale//LC_MESSAGES/django.po source_file = rest_framework/locale/en_US/LC_MESSAGES/django.po source_lang = en_US type = PO - diff --git a/docs/api-guide/caching.md b/docs/api-guide/caching.md index 289b5a2b2..ed3f62c21 100644 --- a/docs/api-guide/caching.md +++ b/docs/api-guide/caching.md @@ -1,6 +1,6 @@ # Caching -> A certain woman had a very sharp conciousness but almost no +> A certain woman had a very sharp conciousness but almost no > memory ... She remembered enough to work, and she worked hard. > - Lydia Davis @@ -22,9 +22,9 @@ from rest_framework.views import APIView from rest_framework import viewsets class UserViewSet(viewsets.Viewset): - + # Cache requested url for each user for 2 hours - @method_decorator(cache_page(60*60*2)) + @method_decorator(cache_page(60*60*2)) @method_decorator(vary_on_cookie) def list(self, request, format=None): content = { @@ -35,7 +35,7 @@ class UserViewSet(viewsets.Viewset): class PostView(APIView): # Cache page for the requested url - @method_decorator(cache_page(60*60*2)) + @method_decorator(cache_page(60*60*2)) def get(self, request, format=None): content = { 'title': 'Post title', diff --git a/docs/api-guide/generic-views.md b/docs/api-guide/generic-views.md index 381f1fe73..a0ed7bdea 100644 --- a/docs/api-guide/generic-views.md +++ b/docs/api-guide/generic-views.md @@ -113,11 +113,11 @@ For example: Note that if your API doesn't include any object level permissions, you may optionally exclude the `self.check_object_permissions`, and simply return the object from the `get_object_or_404` lookup. -#### `filter_queryset(self, queryset)` +#### `filter_queryset(self, queryset)` -Given a queryset, filter it with whichever filter backends are in use, returning a new queryset. +Given a queryset, filter it with whichever filter backends are in use, returning a new queryset. -For example: +For example: def filter_queryset(self, queryset): filter_backends = (CategoryFilter,) diff --git a/docs/api-guide/permissions.md b/docs/api-guide/permissions.md index ef9ce3abd..3b89e9141 100644 --- a/docs/api-guide/permissions.md +++ b/docs/api-guide/permissions.md @@ -197,15 +197,15 @@ If you need to test if a request is a read operation or a write operation, you s --- Custom permissions will raise a `PermissionDenied` exception if the test fails. To change the error message associated with the exception, implement a `message` attribute directly on your custom permission. Otherwise the `default_detail` attribute from `PermissionDenied` will be used. - + from rest_framework import permissions class CustomerAccessPermission(permissions.BasePermission): message = 'Adding customers not allowed.' - + def has_permission(self, request, view): ... - + ## Examples The following is an example of a permission class that checks the incoming request's IP address against a blacklist, and denies the request if the IP has been blacklisted. diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md index 0c6aab152..84ca82a3f 100644 --- a/docs/api-guide/routers.md +++ b/docs/api-guide/routers.md @@ -58,11 +58,11 @@ For example, you can append `router.urls` to a list of existing views… router = routers.SimpleRouter() router.register(r'users', UserViewSet) router.register(r'accounts', AccountViewSet) - + urlpatterns = [ url(r'^forgot-password/$', ForgotPasswordFormView.as_view()), ] - + urlpatterns += router.urls Alternatively you can use Django's `include` function, like so… @@ -106,10 +106,10 @@ For example, if you want to change the URL for our custom action to `^users/{pk} from myapp.permissions import IsAdminOrIsSelf from rest_framework.decorators import detail_route - + class UserViewSet(ModelViewSet): ... - + @detail_route(methods=['post'], permission_classes=[IsAdminOrIsSelf], url_path='change-password') def set_password(self, request, pk=None): ... @@ -124,10 +124,10 @@ For example, if you want to change the name of our custom action to `'user-chang from myapp.permissions import IsAdminOrIsSelf from rest_framework.decorators import detail_route - + class UserViewSet(ModelViewSet): ... - + @detail_route(methods=['post'], permission_classes=[IsAdminOrIsSelf], url_name='change-password') def set_password(self, request, pk=None): ... diff --git a/docs/api-guide/schemas.md b/docs/api-guide/schemas.md index 29b779d50..22894a978 100644 --- a/docs/api-guide/schemas.md +++ b/docs/api-guide/schemas.md @@ -784,4 +784,3 @@ in [OpenAPI][open-api] format. [api-blueprint]: https://apiblueprint.org/ [static-files]: https://docs.djangoproject.com/en/stable/howto/static-files/ [named-arguments]: https://docs.djangoproject.com/en/stable/topics/http/urls/#named-groups - \ No newline at end of file diff --git a/docs/api-guide/validators.md b/docs/api-guide/validators.md index 0e58c6fff..fe492c0a7 100644 --- a/docs/api-guide/validators.md +++ b/docs/api-guide/validators.md @@ -84,7 +84,7 @@ It has two required arguments, and a single optional `messages` argument: The validator should be applied to *serializer classes*, like so: from rest_framework.validators import UniqueTogetherValidator - + class ExampleSerializer(serializers.Serializer): # ... class Meta: diff --git a/docs/topics/3.7-announcement.md b/docs/topics/3.7-announcement.md index 709580a4b..a916f67b4 100644 --- a/docs/topics/3.7-announcement.md +++ b/docs/topics/3.7-announcement.md @@ -1,4 +1,3 @@ -