Skip to content

Commit 878a57d

Browse files
authored
Fix typos (#53)
1 parent 3e4db8e commit 878a57d

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

multipart/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class ParseError(FormParserError):
99
"""
1010

1111
#: This is the offset in the input data chunk (*NOT* the overall stream) in
12-
#: which the parse error occured. It will be -1 if not specified.
12+
#: which the parse error occurred. It will be -1 if not specified.
1313
offset = -1
1414

1515

multipart/multipart.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
STATES = [
3636
"START",
37-
"START_BOUNDARY", "HEADER_FEILD_START", "HEADER_FIELD", "HEADER_VALUE_START", "HEADER_VALUE",
37+
"START_BOUNDARY", "HEADER_FIELD_START", "HEADER_FIELD", "HEADER_VALUE_START", "HEADER_VALUE",
3838
"HEADER_VALUE_ALMOST_DONE", "HEADRES_ALMOST_DONE", "PART_DATA_START", "PART_DATA", "PART_DATA_END", "END"
3939
]
4040

@@ -789,9 +789,9 @@ def _internal_write(self, data, length):
789789
# Depending on our state...
790790
if state == STATE_BEFORE_FIELD:
791791
# If the 'found_sep' flag is set, we've already encountered
792-
# and skipped a single seperator. If so, we check our strict
792+
# and skipped a single separator. If so, we check our strict
793793
# parsing flag and decide what to do. Otherwise, we haven't
794-
# yet reached a seperator, and thus, if we do, we need to skip
794+
# yet reached a separator, and thus, if we do, we need to skip
795795
# it as it will be the boundary between fields that's supposed
796796
# to be there.
797797
if ch == AMPERSAND or ch == SEMICOLON:
@@ -809,7 +809,7 @@ def _internal_write(self, data, length):
809809
"semicolon at %d", i)
810810
else:
811811
# This case is when we're skipping the (first)
812-
# seperator between fields, so we just set our flag
812+
# separator between fields, so we just set our flag
813813
# and continue on.
814814
found_sep = True
815815
else:
@@ -822,14 +822,14 @@ def _internal_write(self, data, length):
822822
found_sep = False
823823

824824
elif state == STATE_FIELD_NAME:
825-
# Try and find a seperator - we ensure that, if we do, we only
825+
# Try and find a separator - we ensure that, if we do, we only
826826
# look for the equal sign before it.
827827
sep_pos = data.find(b'&', i)
828828
if sep_pos == -1:
829829
sep_pos = data.find(b';', i)
830830

831831
# See if we can find an equals sign in the remaining data. If
832-
# so, we can immedately emit the field name and jump to the
832+
# so, we can immediately emit the field name and jump to the
833833
# data state.
834834
if sep_pos != -1:
835835
equals_pos = data.find(b'=', i, sep_pos)
@@ -849,7 +849,7 @@ def _internal_write(self, data, length):
849849
# No equals sign found.
850850
if not strict_parsing:
851851
# See also comments in the STATE_FIELD_DATA case below.
852-
# If we found the seperator, we emit the name and just
852+
# If we found the separator, we emit the name and just
853853
# end - there's no data callback at all (not even with
854854
# a blank value).
855855
if sep_pos != -1:
@@ -859,13 +859,13 @@ def _internal_write(self, data, length):
859859
i = sep_pos - 1
860860
state = STATE_BEFORE_FIELD
861861
else:
862-
# Otherwise, no seperator in this block, so the
862+
# Otherwise, no separator in this block, so the
863863
# rest of this chunk must be a name.
864864
self.callback('field_name', data, i, length)
865865
i = length
866866

867867
else:
868-
# We're parsing strictly. If we find a seperator,
868+
# We're parsing strictly. If we find a separator,
869869
# this is an error - we require an equals sign.
870870
if sep_pos != -1:
871871
e = QuerystringParseError(
@@ -877,7 +877,7 @@ def _internal_write(self, data, length):
877877
e.offset = i
878878
raise e
879879

880-
# No seperator in the rest of this chunk, so it's just
880+
# No separator in the rest of this chunk, so it's just
881881
# a field name.
882882
self.callback('field_name', data, i, length)
883883
i = length
@@ -895,7 +895,7 @@ def _internal_write(self, data, length):
895895
self.callback('field_data', data, i, sep_pos)
896896
self.callback('field_end')
897897

898-
# Note that we go to the seperator, which brings us to the
898+
# Note that we go to the separator, which brings us to the
899899
# "before field" state. This allows us to properly emit
900900
# "field_start" events only when we actually have data for
901901
# a field of some sort.
@@ -1006,7 +1006,7 @@ def __init__(self, boundary, callbacks={}, max_size=float('inf')):
10061006
self.max_size = max_size
10071007
self._current_size = 0
10081008

1009-
# Setup marks. These are used to track the state of data recieved.
1009+
# Setup marks. These are used to track the state of data received.
10101010
self.marks = {}
10111011

10121012
# TODO: Actually use this rather than the dumb version we currently use
@@ -1500,7 +1500,7 @@ class FormParser:
15001500
:class:`File`, but you can provide your own class if you
15011501
wish to customize behaviour. The class will be
15021502
instantiated as FileClass(file_name, field_name), and it
1503-
must provide the folllowing functions::
1503+
must provide the following functions::
15041504
file_instance.write(data)
15051505
file_instance.finalize()
15061506
file_instance.close()
@@ -1509,7 +1509,7 @@ class FormParser:
15091509
:class:`Field`, but you can provide your own class if
15101510
you wish to customize behaviour. The class will be
15111511
instantiated as FieldClass(field_name), and it must
1512-
provide the folllowing functions::
1512+
provide the following functions::
15131513
field_instance.write(data)
15141514
field_instance.finalize()
15151515
field_instance.close()

multipart/tests/test_multipart.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def test_streaming_break(self):
391391
(b'asdf', b'baz')
392392
)
393393

394-
def test_semicolon_seperator(self):
394+
def test_semicolon_separator(self):
395395
self.p.write(b'foo=bar;asdf=baz')
396396

397397
self.assert_fields(
@@ -1070,7 +1070,7 @@ def on_file(f):
10701070
f.write(b'1234')
10711071
f.finalize()
10721072

1073-
# Assert that we only recieved a single file, with the right data, and that we're done.
1073+
# Assert that we only received a single file, with the right data, and that we're done.
10741074
self.assertFalse(on_field.called)
10751075
self.assertEqual(len(files), 1)
10761076
self.assert_file_data(files[0], b'test1234')
@@ -1094,7 +1094,7 @@ def simple_test(f):
10941094
f.write(b'&test=asdf')
10951095
f.finalize()
10961096

1097-
# Assert we only recieved 2 fields...
1097+
# Assert we only received 2 fields...
10981098
self.assertFalse(on_file.called)
10991099
self.assertEqual(len(fields), 2)
11001100

@@ -1303,4 +1303,3 @@ def suite():
13031303
suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(TestHelperFunctions))
13041304

13051305
return suite
1306-

0 commit comments

Comments
 (0)