Skip to content

Commit

Permalink
Clean up all whitespace throughout project (encode#5578)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
jdufresne authored and Pierre Chiquet committed Mar 24, 2020
1 parent f6be00d commit a74b05a
Show file tree
Hide file tree
Showing 22 changed files with 32 additions and 36 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
MANIFEST
coverage.*

!.editorconfig
!.gitignore
!.travis.yml
!.isort.cfg
1 change: 0 additions & 1 deletion .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ file_filter = rest_framework/locale/<lang>/LC_MESSAGES/django.po
source_file = rest_framework/locale/en_US/LC_MESSAGES/django.po
source_lang = en_US
type = PO

8 changes: 4 additions & 4 deletions docs/api-guide/caching.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 = {
Expand All @@ -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',
Expand Down
6 changes: 3 additions & 3 deletions docs/api-guide/generic-views.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,)
Expand Down
6 changes: 3 additions & 3 deletions docs/api-guide/permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 6 additions & 6 deletions docs/api-guide/routers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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…
Expand Down Expand Up @@ -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):
...
Expand All @@ -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):
...
Expand Down
1 change: 0 additions & 1 deletion docs/api-guide/schemas.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 changes: 1 addition & 1 deletion docs/api-guide/validators.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion docs/topics/3.7-announcement.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<style>
.promo li a {
float: left;
Expand Down
2 changes: 1 addition & 1 deletion docs/topics/browser-enhancements.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Prior to version 3.3.0 the semi extension header `X-HTTP-Method-Override` was su
For example:

METHOD_OVERRIDE_HEADER = 'HTTP_X_HTTP_METHOD_OVERRIDE'

class MethodOverrideMiddleware(object):
def process_view(self, request, callback, callback_args, callback_kwargs):
if request.method != 'POST':
Expand Down
4 changes: 2 additions & 2 deletions docs/topics/html-and-forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Here's an example of a view that returns a list of "Profile" instances, rendered
{% endfor %}
</ul>
</body></html>

## Rendering Forms

Serializers may be rendered as forms by using the `render_form` template tag, and including the serializer instance as context to the template.
Expand Down Expand Up @@ -77,7 +77,7 @@ The following view demonstrates an example of using a serializer in a template f
{% load rest_framework %}

<html><body>

<h1>Profile - {{ profile.name }}</h1>

<form action="{% url 'profile-detail' pk=profile.pk %}" method="POST">
Expand Down
2 changes: 1 addition & 1 deletion docs/topics/jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Wonder how else you can help? One of the best ways you can help Django REST Fram
[stackoverflow-com]: http://stackoverflow.com/jobs/developer-jobs-using-django
[upwork-com]: https://www.upwork.com/o/jobs/browse/skill/django-framework/
[technobjobs-co-uk]: https://www.technojobs.co.uk/django-jobs
[remoteok-io]: https://remoteok.io/remote-django-jobs
[remoteok-io]: https://remoteok.io/remote-django-jobs
[remotepython-com]: https://www.remotepython.com/jobs/
[drf-funding]: https://fund.django-rest-framework.org/topics/funding/
[submit-pr]: https://github.com/encode/django-rest-framework
Expand Down
1 change: 0 additions & 1 deletion rest_framework/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,4 +318,3 @@ def authenticate(request=None, **credentials):
return authenticate(**credentials)
else:
return authenticate(request=request, **credentials)

1 change: 0 additions & 1 deletion rest_framework/static/rest_framework/css/default.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/* The navbar is fixed at >= 980px wide, so add padding to the body to prevent
content running up underneath it. */

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions rest_framework/templates/rest_framework/docs/error.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,3 @@ <h2>Overriding this template</h2>
<script src="{% static 'rest_framework/docs/js/jquery-1.10.2.min.js' %}"></script>
</body>
</html>




Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
<pre class="highlight javascript hide" data-language="javascript"><code>{% code html %}<!-- Load the JavaScript client library -->
<script src="{% static 'rest_framework/js/coreapi-0.1.1.js' %}"></script>
<script src="{% url 'api-docs:schema-js' %}"></script>{% endcode %}</code></pre>

1 change: 0 additions & 1 deletion tests/importable/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@

from rest_framework import compat # noqa
1 change: 0 additions & 1 deletion tests/importable/test_installed.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from django.conf import settings
from tests import importable

Expand Down

0 comments on commit a74b05a

Please sign in to comment.