Skip to content

Commit e1768bd

Browse files
Stranger6667tomchristie
authored andcommitted
Fixed various typos (#4366)
1 parent febaa4d commit e1768bd

17 files changed

+33
-33
lines changed

rest_framework/compat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def value_from_object(field, obj):
168168
crispy_forms = None
169169

170170

171-
# coreapi is optional (Note that uritemplate is a dependancy of coreapi)
171+
# coreapi is optional (Note that uritemplate is a dependency of coreapi)
172172
try:
173173
import coreapi
174174
import uritemplate

rest_framework/fields.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,8 @@ def get_value(self, dictionary):
395395
# determine if we should use null instead.
396396
return '' if getattr(self, 'allow_blank', False) else None
397397
elif ret == '' and not self.required:
398-
# If the field is blank, and emptyness is valid then
399-
# determine if we should use emptyness instead.
398+
# If the field is blank, and emptiness is valid then
399+
# determine if we should use emptiness instead.
400400
return '' if getattr(self, 'allow_blank', False) else empty
401401
return ret
402402
return dictionary.get(self.field_name, empty)
@@ -1346,7 +1346,7 @@ class FilePathField(ChoiceField):
13461346

13471347
def __init__(self, path, match=None, recursive=False, allow_files=True,
13481348
allow_folders=False, required=None, **kwargs):
1349-
# Defer to Django's FilePathField implmentation to get the
1349+
# Defer to Django's FilePathField implementation to get the
13501350
# valid set of choices.
13511351
field = DjangoFilePathField(
13521352
path, match=match, recursive=recursive, allow_files=allow_files,

rest_framework/negotiation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def filter_renderers(self, renderers, format):
9090

9191
def get_accept_list(self, request):
9292
"""
93-
Given the incoming request, return a tokenised list of media
93+
Given the incoming request, return a tokenized list of media
9494
type strings.
9595
"""
9696
header = request.META.get('HTTP_ACCEPT', '*/*')

rest_framework/pagination.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ def _get_displayed_page_numbers(current, final):
6464
6565
This implementation gives one page to each side of the cursor,
6666
or two pages to the side when the cursor is at the edge, then
67-
ensures that any breaks between non-continous page numbers never
67+
ensures that any breaks between non-continuous page numbers never
6868
remove only a single page.
6969
70-
For an alernativative implementation which gives two pages to each side of
70+
For an alternative implementation which gives two pages to each side of
7171
the cursor, eg. as in GitHub issue list pagination, see:
7272
7373
https://gist.github.com/tomchristie/321140cebb1c4a558b15
@@ -476,10 +476,10 @@ def paginate_queryset(self, queryset, request, view=None):
476476

477477
# Determine the position of the final item following the page.
478478
if len(results) > len(self.page):
479-
has_following_postion = True
479+
has_following_position = True
480480
following_position = self._get_position_from_instance(results[-1], self.ordering)
481481
else:
482-
has_following_postion = False
482+
has_following_position = False
483483
following_position = None
484484

485485
# If we have a reverse queryset, then the query ordering was in reverse
@@ -490,14 +490,14 @@ def paginate_queryset(self, queryset, request, view=None):
490490
if reverse:
491491
# Determine next and previous positions for reverse cursors.
492492
self.has_next = (current_position is not None) or (offset > 0)
493-
self.has_previous = has_following_postion
493+
self.has_previous = has_following_position
494494
if self.has_next:
495495
self.next_position = current_position
496496
if self.has_previous:
497497
self.previous_position = following_position
498498
else:
499499
# Determine next and previous positions for forward cursors.
500-
self.has_next = has_following_postion
500+
self.has_next = has_following_position
501501
self.has_previous = (current_position is not None) or (offset > 0)
502502
if self.has_next:
503503
self.next_position = following_position
@@ -534,7 +534,7 @@ def get_next_link(self):
534534
# our marker.
535535
break
536536

537-
# The item in this postion has the same position as the item
537+
# The item in this position has the same position as the item
538538
# following it, we can't use it as a marker position, so increment
539539
# the offset and keep seeking to the previous item.
540540
compare = position
@@ -582,7 +582,7 @@ def get_previous_link(self):
582582
# our marker.
583583
break
584584

585-
# The item in this postion has the same position as the item
585+
# The item in this position has the same position as the item
586586
# following it, we can't use it as a marker position, so increment
587587
# the offset and keep seeking to the previous item.
588588
compare = position

rest_framework/serializers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,7 @@ def get_validators(self):
13831383

13841384
def get_unique_together_validators(self):
13851385
"""
1386-
Determine a default set of validators for any unique_together contraints.
1386+
Determine a default set of validators for any unique_together constraints.
13871387
"""
13881388
model_class_inheritance_tree = (
13891389
[self.Meta.model] +
@@ -1414,7 +1414,7 @@ def get_unique_together_validators(self):
14141414

14151415
def get_unique_for_date_validators(self):
14161416
"""
1417-
Determine a default set of validators for the following contraints:
1417+
Determine a default set of validators for the following constraints:
14181418
14191419
* unique_for_date
14201420
* unique_for_month

rest_framework/templatetags/rest_framework.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def urlize_quoted_links(text, trim_url_limit=None, nofollow=True, autoescape=Tru
189189
leading punctuation (opening parens) and it'll still do the right thing.
190190
191191
If trim_url_limit is not None, the URLs in link text longer than this limit
192-
will truncated to trim_url_limit-3 characters and appended with an elipsis.
192+
will truncated to trim_url_limit-3 characters and appended with an ellipsis.
193193
194194
If nofollow is True, the URLs in link text will get a rel="nofollow"
195195
attribute.

rest_framework/utils/field_mapping.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
Helper functions for mapping model fields to a dictionary of default
3-
keyword arguments that should be used for their equivelent serializer fields.
3+
keyword arguments that should be used for their equivalent serializer fields.
44
"""
55
import inspect
66

rest_framework/utils/html.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def is_html_input(dictionary):
1414

1515
def parse_html_list(dictionary, prefix=''):
1616
"""
17-
Used to suport list values in HTML forms.
17+
Used to support list values in HTML forms.
1818
Supports lists of primitives and/or dictionaries.
1919
2020
* List of primitives.

rest_framework/versioning.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class NamespaceVersioning(BaseVersioning):
9494
The difference is in the backend - this implementation uses
9595
Django's URL namespaces to determine the version.
9696
97-
An example URL conf that is namespaced into two seperate versions
97+
An example URL conf that is namespaced into two separate versions
9898
9999
# users/urls.py
100100
urlpatterns = [
@@ -147,7 +147,7 @@ class HostNameVersioning(BaseVersioning):
147147
invalid_version_message = _('Invalid version in hostname.')
148148

149149
def determine_version(self, request, *args, **kwargs):
150-
hostname, seperator, port = request.get_host().partition(':')
150+
hostname, separator, port = request.get_host().partition(':')
151151
match = self.hostname_regex.match(hostname)
152152
if not match:
153153
return self.default_version

rest_framework/viewsets.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def initialize_request(self, request, *args, **kwargs):
112112
if method == 'options':
113113
# This is a special case as we always provide handling for the
114114
# options method in the base `View` class.
115-
# Unlike the other explicitly defined actions, 'metadata' is implict.
115+
# Unlike the other explicitly defined actions, 'metadata' is implicit.
116116
self.action = 'metadata'
117117
else:
118118
self.action = self.action_map.get(method)

tests/test_authentication.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ def test_failing_auth_accessed_in_renderer(self):
440440
class NoAuthenticationClassesTests(TestCase):
441441
def test_permission_message_with_no_authentication_classes(self):
442442
"""
443-
An unauthenticated request made against a view that containes no
443+
An unauthenticated request made against a view that contains no
444444
`authentication_classes` but do contain `permissions_classes` the error
445445
code returned should be 403 with the exception's message.
446446
"""

tests/test_fields.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ class TestDateField(FieldValues):
974974

975975
class TestCustomInputFormatDateField(FieldValues):
976976
"""
977-
Valid and invalid values for `DateField` with a cutom input format.
977+
Valid and invalid values for `DateField` with a custom input format.
978978
"""
979979
valid_inputs = {
980980
'1 Jan 2001': datetime.date(2001, 1, 1),
@@ -1041,7 +1041,7 @@ class TestDateTimeField(FieldValues):
10411041

10421042
class TestCustomInputFormatDateTimeField(FieldValues):
10431043
"""
1044-
Valid and invalid values for `DateTimeField` with a cutom input format.
1044+
Valid and invalid values for `DateTimeField` with a custom input format.
10451045
"""
10461046
valid_inputs = {
10471047
'1:35pm, 1 Jan 2001': datetime.datetime(2001, 1, 1, 13, 35, tzinfo=timezone.UTC()),

tests/test_filters.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ class OrderingListView(generics.ListAPIView):
711711
serializer_class = OrderingFilterSerializer
712712
filter_backends = (filters.OrderingFilter,)
713713
ordering = ('title',)
714-
oredering_fields = ('text',)
714+
ordering_fields = ('text',)
715715

716716
view = OrderingListView.as_view()
717717
request = factory.get('')
@@ -819,7 +819,7 @@ class OrderingListView(generics.ListAPIView):
819819
queryset = OrderingFilterModel.objects.all()
820820
filter_backends = (filters.OrderingFilter,)
821821
ordering = ('title',)
822-
# note: no ordering_fields and serializer_class speficied
822+
# note: no ordering_fields and serializer_class specified
823823

824824
def get_serializer_class(self):
825825
return OrderingFilterSerializer
@@ -842,7 +842,7 @@ class OrderingListView(generics.ListAPIView):
842842
filter_backends = (filters.OrderingFilter,)
843843
ordering = ('title',)
844844
# note: no ordering_fields and serializer_class
845-
# or get_serializer_class speficied
845+
# or get_serializer_class specified
846846

847847
view = OrderingListView.as_view()
848848
request = factory.get('/', {'ordering': 'text'})

tests/test_model_serializer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class Meta:
136136
class TestRegularFieldMappings(TestCase):
137137
def test_regular_fields(self):
138138
"""
139-
Model fields should map to their equivelent serializer fields.
139+
Model fields should map to their equivalent serializer fields.
140140
"""
141141
class TestSerializer(serializers.ModelSerializer):
142142
class Meta:

tests/test_pagination.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ def test_setting_page_size(self):
6767

6868
def test_setting_page_size_over_maximum(self):
6969
"""
70-
When page_size parameter exceeds maxiumum allowable,
71-
then it should be capped to the maxiumum.
70+
When page_size parameter exceeds maximum allowable,
71+
then it should be capped to the maximum.
7272
"""
7373
request = factory.get('/', {'page_size': 1000})
7474
response = self.view(request)
@@ -259,7 +259,7 @@ class TestPageNumberPaginationOverride:
259259

260260
def setup(self):
261261
class OverriddenDjangoPaginator(DjangoPaginator):
262-
# override the count in our overriden Django Paginator
262+
# override the count in our overridden Django Paginator
263263
# we will only return one page, with one item
264264
count = 1
265265

tests/test_templatetags.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
class TemplateTagTests(TestCase):
1515

16-
def test_add_query_param_with_non_latin_charactor(self):
16+
def test_add_query_param_with_non_latin_character(self):
1717
# Ensure we don't double-escape non-latin characters
1818
# that are present in the querystring.
1919
# See #1314.

tests/test_testing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def test_force_authenticate_with_sessions(self):
7878
response = self.client.get('/session-view/')
7979
self.assertEqual(response.data['active_session'], False)
8080

81-
# Subsequant requests have an active session
81+
# Subsequent requests have an active session
8282
response = self.client.get('/session-view/')
8383
self.assertEqual(response.data['active_session'], True)
8484

0 commit comments

Comments
 (0)