From e1768bdc161ee6c4fab422d0f47e54f9bf257ce2 Mon Sep 17 00:00:00 2001 From: Dmitry Dygalo Date: Mon, 8 Aug 2016 10:32:22 +0200 Subject: [PATCH] Fixed various typos (#4366) --- rest_framework/compat.py | 2 +- rest_framework/fields.py | 6 +++--- rest_framework/negotiation.py | 2 +- rest_framework/pagination.py | 16 ++++++++-------- rest_framework/serializers.py | 4 ++-- rest_framework/templatetags/rest_framework.py | 2 +- rest_framework/utils/field_mapping.py | 2 +- rest_framework/utils/html.py | 2 +- rest_framework/versioning.py | 4 ++-- rest_framework/viewsets.py | 2 +- tests/test_authentication.py | 2 +- tests/test_fields.py | 4 ++-- tests/test_filters.py | 6 +++--- tests/test_model_serializer.py | 2 +- tests/test_pagination.py | 6 +++--- tests/test_templatetags.py | 2 +- tests/test_testing.py | 2 +- 17 files changed, 33 insertions(+), 33 deletions(-) diff --git a/rest_framework/compat.py b/rest_framework/compat.py index 1ab1478f1..cee430a84 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -168,7 +168,7 @@ except ImportError: crispy_forms = None -# coreapi is optional (Note that uritemplate is a dependancy of coreapi) +# coreapi is optional (Note that uritemplate is a dependency of coreapi) try: import coreapi import uritemplate diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 704dbaf3f..b4346cd85 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -395,8 +395,8 @@ class Field(object): # determine if we should use null instead. return '' if getattr(self, 'allow_blank', False) else None elif ret == '' and not self.required: - # If the field is blank, and emptyness is valid then - # determine if we should use emptyness instead. + # If the field is blank, and emptiness is valid then + # determine if we should use emptiness instead. return '' if getattr(self, 'allow_blank', False) else empty return ret return dictionary.get(self.field_name, empty) @@ -1346,7 +1346,7 @@ class FilePathField(ChoiceField): def __init__(self, path, match=None, recursive=False, allow_files=True, allow_folders=False, required=None, **kwargs): - # Defer to Django's FilePathField implmentation to get the + # Defer to Django's FilePathField implementation to get the # valid set of choices. field = DjangoFilePathField( path, match=match, recursive=recursive, allow_files=allow_files, diff --git a/rest_framework/negotiation.py b/rest_framework/negotiation.py index 2a2b6f168..ca1b59f12 100644 --- a/rest_framework/negotiation.py +++ b/rest_framework/negotiation.py @@ -90,7 +90,7 @@ class DefaultContentNegotiation(BaseContentNegotiation): def get_accept_list(self, request): """ - Given the incoming request, return a tokenised list of media + Given the incoming request, return a tokenized list of media type strings. """ header = request.META.get('HTTP_ACCEPT', '*/*') diff --git a/rest_framework/pagination.py b/rest_framework/pagination.py index 6ad10d860..77c10337e 100644 --- a/rest_framework/pagination.py +++ b/rest_framework/pagination.py @@ -64,10 +64,10 @@ def _get_displayed_page_numbers(current, final): This implementation gives one page to each side of the cursor, or two pages to the side when the cursor is at the edge, then - ensures that any breaks between non-continous page numbers never + ensures that any breaks between non-continuous page numbers never remove only a single page. - For an alernativative implementation which gives two pages to each side of + For an alternative implementation which gives two pages to each side of the cursor, eg. as in GitHub issue list pagination, see: https://gist.github.com/tomchristie/321140cebb1c4a558b15 @@ -476,10 +476,10 @@ class CursorPagination(BasePagination): # Determine the position of the final item following the page. if len(results) > len(self.page): - has_following_postion = True + has_following_position = True following_position = self._get_position_from_instance(results[-1], self.ordering) else: - has_following_postion = False + has_following_position = False following_position = None # If we have a reverse queryset, then the query ordering was in reverse @@ -490,14 +490,14 @@ class CursorPagination(BasePagination): if reverse: # Determine next and previous positions for reverse cursors. self.has_next = (current_position is not None) or (offset > 0) - self.has_previous = has_following_postion + self.has_previous = has_following_position if self.has_next: self.next_position = current_position if self.has_previous: self.previous_position = following_position else: # Determine next and previous positions for forward cursors. - self.has_next = has_following_postion + self.has_next = has_following_position self.has_previous = (current_position is not None) or (offset > 0) if self.has_next: self.next_position = following_position @@ -534,7 +534,7 @@ class CursorPagination(BasePagination): # our marker. break - # The item in this postion has the same position as the item + # The item in this position has the same position as the item # following it, we can't use it as a marker position, so increment # the offset and keep seeking to the previous item. compare = position @@ -582,7 +582,7 @@ class CursorPagination(BasePagination): # our marker. break - # The item in this postion has the same position as the item + # The item in this position has the same position as the item # following it, we can't use it as a marker position, so increment # the offset and keep seeking to the previous item. compare = position diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index 27c8cc229..41412af8a 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -1383,7 +1383,7 @@ class ModelSerializer(Serializer): def get_unique_together_validators(self): """ - Determine a default set of validators for any unique_together contraints. + Determine a default set of validators for any unique_together constraints. """ model_class_inheritance_tree = ( [self.Meta.model] + @@ -1414,7 +1414,7 @@ class ModelSerializer(Serializer): def get_unique_for_date_validators(self): """ - Determine a default set of validators for the following contraints: + Determine a default set of validators for the following constraints: * unique_for_date * unique_for_month diff --git a/rest_framework/templatetags/rest_framework.py b/rest_framework/templatetags/rest_framework.py index 05a7ce04f..225edcbee 100644 --- a/rest_framework/templatetags/rest_framework.py +++ b/rest_framework/templatetags/rest_framework.py @@ -189,7 +189,7 @@ def urlize_quoted_links(text, trim_url_limit=None, nofollow=True, autoescape=Tru leading punctuation (opening parens) and it'll still do the right thing. If trim_url_limit is not None, the URLs in link text longer than this limit - will truncated to trim_url_limit-3 characters and appended with an elipsis. + will truncated to trim_url_limit-3 characters and appended with an ellipsis. If nofollow is True, the URLs in link text will get a rel="nofollow" attribute. diff --git a/rest_framework/utils/field_mapping.py b/rest_framework/utils/field_mapping.py index 311d58317..64df9a08e 100644 --- a/rest_framework/utils/field_mapping.py +++ b/rest_framework/utils/field_mapping.py @@ -1,6 +1,6 @@ """ Helper functions for mapping model fields to a dictionary of default -keyword arguments that should be used for their equivelent serializer fields. +keyword arguments that should be used for their equivalent serializer fields. """ import inspect diff --git a/rest_framework/utils/html.py b/rest_framework/utils/html.py index 121c825c7..ca062c9fc 100644 --- a/rest_framework/utils/html.py +++ b/rest_framework/utils/html.py @@ -14,7 +14,7 @@ def is_html_input(dictionary): def parse_html_list(dictionary, prefix=''): """ - Used to suport list values in HTML forms. + Used to support list values in HTML forms. Supports lists of primitives and/or dictionaries. * List of primitives. diff --git a/rest_framework/versioning.py b/rest_framework/versioning.py index 763a92b4c..f533ef580 100644 --- a/rest_framework/versioning.py +++ b/rest_framework/versioning.py @@ -94,7 +94,7 @@ class NamespaceVersioning(BaseVersioning): The difference is in the backend - this implementation uses Django's URL namespaces to determine the version. - An example URL conf that is namespaced into two seperate versions + An example URL conf that is namespaced into two separate versions # users/urls.py urlpatterns = [ @@ -147,7 +147,7 @@ class HostNameVersioning(BaseVersioning): invalid_version_message = _('Invalid version in hostname.') def determine_version(self, request, *args, **kwargs): - hostname, seperator, port = request.get_host().partition(':') + hostname, separator, port = request.get_host().partition(':') match = self.hostname_regex.match(hostname) if not match: return self.default_version diff --git a/rest_framework/viewsets.py b/rest_framework/viewsets.py index 2f440c567..bd8333504 100644 --- a/rest_framework/viewsets.py +++ b/rest_framework/viewsets.py @@ -112,7 +112,7 @@ class ViewSetMixin(object): if method == 'options': # This is a special case as we always provide handling for the # options method in the base `View` class. - # Unlike the other explicitly defined actions, 'metadata' is implict. + # Unlike the other explicitly defined actions, 'metadata' is implicit. self.action = 'metadata' else: self.action = self.action_map.get(method) diff --git a/tests/test_authentication.py b/tests/test_authentication.py index 1f95396aa..5ef620abe 100644 --- a/tests/test_authentication.py +++ b/tests/test_authentication.py @@ -440,7 +440,7 @@ class FailingAuthAccessedInRenderer(TestCase): class NoAuthenticationClassesTests(TestCase): def test_permission_message_with_no_authentication_classes(self): """ - An unauthenticated request made against a view that containes no + An unauthenticated request made against a view that contains no `authentication_classes` but do contain `permissions_classes` the error code returned should be 403 with the exception's message. """ diff --git a/tests/test_fields.py b/tests/test_fields.py index 92f4548e5..60f02777a 100644 --- a/tests/test_fields.py +++ b/tests/test_fields.py @@ -974,7 +974,7 @@ class TestDateField(FieldValues): class TestCustomInputFormatDateField(FieldValues): """ - Valid and invalid values for `DateField` with a cutom input format. + Valid and invalid values for `DateField` with a custom input format. """ valid_inputs = { '1 Jan 2001': datetime.date(2001, 1, 1), @@ -1041,7 +1041,7 @@ class TestDateTimeField(FieldValues): class TestCustomInputFormatDateTimeField(FieldValues): """ - Valid and invalid values for `DateTimeField` with a cutom input format. + Valid and invalid values for `DateTimeField` with a custom input format. """ valid_inputs = { '1:35pm, 1 Jan 2001': datetime.datetime(2001, 1, 1, 13, 35, tzinfo=timezone.UTC()), diff --git a/tests/test_filters.py b/tests/test_filters.py index 175ae5b12..03d61fc37 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -711,7 +711,7 @@ class OrderingFilterTests(TestCase): serializer_class = OrderingFilterSerializer filter_backends = (filters.OrderingFilter,) ordering = ('title',) - oredering_fields = ('text',) + ordering_fields = ('text',) view = OrderingListView.as_view() request = factory.get('') @@ -819,7 +819,7 @@ class OrderingFilterTests(TestCase): queryset = OrderingFilterModel.objects.all() filter_backends = (filters.OrderingFilter,) ordering = ('title',) - # note: no ordering_fields and serializer_class speficied + # note: no ordering_fields and serializer_class specified def get_serializer_class(self): return OrderingFilterSerializer @@ -842,7 +842,7 @@ class OrderingFilterTests(TestCase): filter_backends = (filters.OrderingFilter,) ordering = ('title',) # note: no ordering_fields and serializer_class - # or get_serializer_class speficied + # or get_serializer_class specified view = OrderingListView.as_view() request = factory.get('/', {'ordering': 'text'}) diff --git a/tests/test_model_serializer.py b/tests/test_model_serializer.py index b2d336d84..a14972f04 100644 --- a/tests/test_model_serializer.py +++ b/tests/test_model_serializer.py @@ -136,7 +136,7 @@ class TestModelSerializer(TestCase): class TestRegularFieldMappings(TestCase): def test_regular_fields(self): """ - Model fields should map to their equivelent serializer fields. + Model fields should map to their equivalent serializer fields. """ class TestSerializer(serializers.ModelSerializer): class Meta: diff --git a/tests/test_pagination.py b/tests/test_pagination.py index 4ea706429..f7feb4006 100644 --- a/tests/test_pagination.py +++ b/tests/test_pagination.py @@ -67,8 +67,8 @@ class TestPaginationIntegration: def test_setting_page_size_over_maximum(self): """ - When page_size parameter exceeds maxiumum allowable, - then it should be capped to the maxiumum. + When page_size parameter exceeds maximum allowable, + then it should be capped to the maximum. """ request = factory.get('/', {'page_size': 1000}) response = self.view(request) @@ -259,7 +259,7 @@ class TestPageNumberPaginationOverride: def setup(self): class OverriddenDjangoPaginator(DjangoPaginator): - # override the count in our overriden Django Paginator + # override the count in our overridden Django Paginator # we will only return one page, with one item count = 1 diff --git a/tests/test_templatetags.py b/tests/test_templatetags.py index 746f51b7e..ac218df21 100644 --- a/tests/test_templatetags.py +++ b/tests/test_templatetags.py @@ -13,7 +13,7 @@ factory = APIRequestFactory() class TemplateTagTests(TestCase): - def test_add_query_param_with_non_latin_charactor(self): + def test_add_query_param_with_non_latin_character(self): # Ensure we don't double-escape non-latin characters # that are present in the querystring. # See #1314. diff --git a/tests/test_testing.py b/tests/test_testing.py index e6c8de22d..3adcc55f8 100644 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -78,7 +78,7 @@ class TestAPITestClient(TestCase): response = self.client.get('/session-view/') self.assertEqual(response.data['active_session'], False) - # Subsequant requests have an active session + # Subsequent requests have an active session response = self.client.get('/session-view/') self.assertEqual(response.data['active_session'], True)