Fixed various typos (#4366)

This commit is contained in:
Dmitry Dygalo 2016-08-08 10:32:22 +02:00 committed by Tom Christie
parent febaa4db00
commit e1768bdc16
17 changed files with 33 additions and 33 deletions

View File

@ -168,7 +168,7 @@ except ImportError:
crispy_forms = None 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: try:
import coreapi import coreapi
import uritemplate import uritemplate

View File

@ -395,8 +395,8 @@ class Field(object):
# determine if we should use null instead. # determine if we should use null instead.
return '' if getattr(self, 'allow_blank', False) else None return '' if getattr(self, 'allow_blank', False) else None
elif ret == '' and not self.required: elif ret == '' and not self.required:
# If the field is blank, and emptyness is valid then # If the field is blank, and emptiness is valid then
# determine if we should use emptyness instead. # determine if we should use emptiness instead.
return '' if getattr(self, 'allow_blank', False) else empty return '' if getattr(self, 'allow_blank', False) else empty
return ret return ret
return dictionary.get(self.field_name, empty) 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, def __init__(self, path, match=None, recursive=False, allow_files=True,
allow_folders=False, required=None, **kwargs): 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. # valid set of choices.
field = DjangoFilePathField( field = DjangoFilePathField(
path, match=match, recursive=recursive, allow_files=allow_files, path, match=match, recursive=recursive, allow_files=allow_files,

View File

@ -90,7 +90,7 @@ class DefaultContentNegotiation(BaseContentNegotiation):
def get_accept_list(self, request): 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. type strings.
""" """
header = request.META.get('HTTP_ACCEPT', '*/*') header = request.META.get('HTTP_ACCEPT', '*/*')

View File

@ -64,10 +64,10 @@ def _get_displayed_page_numbers(current, final):
This implementation gives one page to each side of the cursor, 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 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. 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: the cursor, eg. as in GitHub issue list pagination, see:
https://gist.github.com/tomchristie/321140cebb1c4a558b15 https://gist.github.com/tomchristie/321140cebb1c4a558b15
@ -476,10 +476,10 @@ class CursorPagination(BasePagination):
# Determine the position of the final item following the page. # Determine the position of the final item following the page.
if len(results) > len(self.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) following_position = self._get_position_from_instance(results[-1], self.ordering)
else: else:
has_following_postion = False has_following_position = False
following_position = None following_position = None
# If we have a reverse queryset, then the query ordering was in reverse # If we have a reverse queryset, then the query ordering was in reverse
@ -490,14 +490,14 @@ class CursorPagination(BasePagination):
if reverse: if reverse:
# Determine next and previous positions for reverse cursors. # Determine next and previous positions for reverse cursors.
self.has_next = (current_position is not None) or (offset > 0) 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: if self.has_next:
self.next_position = current_position self.next_position = current_position
if self.has_previous: if self.has_previous:
self.previous_position = following_position self.previous_position = following_position
else: else:
# Determine next and previous positions for forward cursors. # 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) self.has_previous = (current_position is not None) or (offset > 0)
if self.has_next: if self.has_next:
self.next_position = following_position self.next_position = following_position
@ -534,7 +534,7 @@ class CursorPagination(BasePagination):
# our marker. # our marker.
break 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 # following it, we can't use it as a marker position, so increment
# the offset and keep seeking to the previous item. # the offset and keep seeking to the previous item.
compare = position compare = position
@ -582,7 +582,7 @@ class CursorPagination(BasePagination):
# our marker. # our marker.
break 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 # following it, we can't use it as a marker position, so increment
# the offset and keep seeking to the previous item. # the offset and keep seeking to the previous item.
compare = position compare = position

View File

@ -1383,7 +1383,7 @@ class ModelSerializer(Serializer):
def get_unique_together_validators(self): 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 = ( model_class_inheritance_tree = (
[self.Meta.model] + [self.Meta.model] +
@ -1414,7 +1414,7 @@ class ModelSerializer(Serializer):
def get_unique_for_date_validators(self): 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_date
* unique_for_month * unique_for_month

View File

@ -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. 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 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" If nofollow is True, the URLs in link text will get a rel="nofollow"
attribute. attribute.

View File

@ -1,6 +1,6 @@
""" """
Helper functions for mapping model fields to a dictionary of default 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 import inspect

View File

@ -14,7 +14,7 @@ def is_html_input(dictionary):
def parse_html_list(dictionary, prefix=''): 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. Supports lists of primitives and/or dictionaries.
* List of primitives. * List of primitives.

View File

@ -94,7 +94,7 @@ class NamespaceVersioning(BaseVersioning):
The difference is in the backend - this implementation uses The difference is in the backend - this implementation uses
Django's URL namespaces to determine the version. 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 # users/urls.py
urlpatterns = [ urlpatterns = [
@ -147,7 +147,7 @@ class HostNameVersioning(BaseVersioning):
invalid_version_message = _('Invalid version in hostname.') invalid_version_message = _('Invalid version in hostname.')
def determine_version(self, request, *args, **kwargs): 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) match = self.hostname_regex.match(hostname)
if not match: if not match:
return self.default_version return self.default_version

View File

@ -112,7 +112,7 @@ class ViewSetMixin(object):
if method == 'options': if method == 'options':
# This is a special case as we always provide handling for the # This is a special case as we always provide handling for the
# options method in the base `View` class. # 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' self.action = 'metadata'
else: else:
self.action = self.action_map.get(method) self.action = self.action_map.get(method)

View File

@ -440,7 +440,7 @@ class FailingAuthAccessedInRenderer(TestCase):
class NoAuthenticationClassesTests(TestCase): class NoAuthenticationClassesTests(TestCase):
def test_permission_message_with_no_authentication_classes(self): 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 `authentication_classes` but do contain `permissions_classes` the error
code returned should be 403 with the exception's message. code returned should be 403 with the exception's message.
""" """

View File

@ -974,7 +974,7 @@ class TestDateField(FieldValues):
class TestCustomInputFormatDateField(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 = { valid_inputs = {
'1 Jan 2001': datetime.date(2001, 1, 1), '1 Jan 2001': datetime.date(2001, 1, 1),
@ -1041,7 +1041,7 @@ class TestDateTimeField(FieldValues):
class TestCustomInputFormatDateTimeField(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 = { valid_inputs = {
'1:35pm, 1 Jan 2001': datetime.datetime(2001, 1, 1, 13, 35, tzinfo=timezone.UTC()), '1:35pm, 1 Jan 2001': datetime.datetime(2001, 1, 1, 13, 35, tzinfo=timezone.UTC()),

View File

@ -711,7 +711,7 @@ class OrderingFilterTests(TestCase):
serializer_class = OrderingFilterSerializer serializer_class = OrderingFilterSerializer
filter_backends = (filters.OrderingFilter,) filter_backends = (filters.OrderingFilter,)
ordering = ('title',) ordering = ('title',)
oredering_fields = ('text',) ordering_fields = ('text',)
view = OrderingListView.as_view() view = OrderingListView.as_view()
request = factory.get('') request = factory.get('')
@ -819,7 +819,7 @@ class OrderingFilterTests(TestCase):
queryset = OrderingFilterModel.objects.all() queryset = OrderingFilterModel.objects.all()
filter_backends = (filters.OrderingFilter,) filter_backends = (filters.OrderingFilter,)
ordering = ('title',) ordering = ('title',)
# note: no ordering_fields and serializer_class speficied # note: no ordering_fields and serializer_class specified
def get_serializer_class(self): def get_serializer_class(self):
return OrderingFilterSerializer return OrderingFilterSerializer
@ -842,7 +842,7 @@ class OrderingFilterTests(TestCase):
filter_backends = (filters.OrderingFilter,) filter_backends = (filters.OrderingFilter,)
ordering = ('title',) ordering = ('title',)
# note: no ordering_fields and serializer_class # note: no ordering_fields and serializer_class
# or get_serializer_class speficied # or get_serializer_class specified
view = OrderingListView.as_view() view = OrderingListView.as_view()
request = factory.get('/', {'ordering': 'text'}) request = factory.get('/', {'ordering': 'text'})

View File

@ -136,7 +136,7 @@ class TestModelSerializer(TestCase):
class TestRegularFieldMappings(TestCase): class TestRegularFieldMappings(TestCase):
def test_regular_fields(self): 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 TestSerializer(serializers.ModelSerializer):
class Meta: class Meta:

View File

@ -67,8 +67,8 @@ class TestPaginationIntegration:
def test_setting_page_size_over_maximum(self): def test_setting_page_size_over_maximum(self):
""" """
When page_size parameter exceeds maxiumum allowable, When page_size parameter exceeds maximum allowable,
then it should be capped to the maxiumum. then it should be capped to the maximum.
""" """
request = factory.get('/', {'page_size': 1000}) request = factory.get('/', {'page_size': 1000})
response = self.view(request) response = self.view(request)
@ -259,7 +259,7 @@ class TestPageNumberPaginationOverride:
def setup(self): def setup(self):
class OverriddenDjangoPaginator(DjangoPaginator): 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 # we will only return one page, with one item
count = 1 count = 1

View File

@ -13,7 +13,7 @@ factory = APIRequestFactory()
class TemplateTagTests(TestCase): 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 # Ensure we don't double-escape non-latin characters
# that are present in the querystring. # that are present in the querystring.
# See #1314. # See #1314.

View File

@ -78,7 +78,7 @@ class TestAPITestClient(TestCase):
response = self.client.get('/session-view/') response = self.client.get('/session-view/')
self.assertEqual(response.data['active_session'], False) 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/') response = self.client.get('/session-view/')
self.assertEqual(response.data['active_session'], True) self.assertEqual(response.data['active_session'], True)