1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed the remaining E302 violations int eh django package

This commit is contained in:
Alex Gaynor
2013-11-02 17:37:15 -07:00
parent 393cdbfaa2
commit fe995e6cbd
19 changed files with 199 additions and 0 deletions

View File

@@ -269,6 +269,7 @@ class MultiPartParser(object):
"""Cleanup filename from Internet Explorer full paths."""
return filename and filename[filename.rfind("\\")+1:].strip()
class LazyStream(six.Iterator):
"""
The LazyStream wrapper allows one to get and "unget" bytes from a stream.
@@ -380,6 +381,7 @@ class LazyStream(six.Iterator):
" if there is none, report this to the Django developers."
)
class ChunkIter(six.Iterator):
"""
An iterable that will yield chunks of data. Given a file-like object as the
@@ -403,6 +405,7 @@ class ChunkIter(six.Iterator):
def __iter__(self):
return self
class InterBoundaryIter(six.Iterator):
"""
A Producer that will iterate over boundaries.
@@ -420,6 +423,7 @@ class InterBoundaryIter(six.Iterator):
except InputStreamExhausted:
raise StopIteration()
class BoundaryIter(six.Iterator):
"""
A Producer that is sensitive to boundaries.
@@ -516,6 +520,7 @@ class BoundaryIter(six.Iterator):
end -= 1
return end, next
def exhaust(stream_or_iterable):
"""
Completely exhausts an iterator or stream.
@@ -534,6 +539,7 @@ def exhaust(stream_or_iterable):
for __ in iterator:
pass
def parse_boundary_stream(stream, max_header_size):
"""
Parses one and exactly one stream that encapsulates a boundary.
@@ -592,6 +598,7 @@ def parse_boundary_stream(stream, max_header_size):
return (TYPE, outdict, stream)
class Parser(object):
def __init__(self, stream, boundary):
self._stream = stream
@@ -603,6 +610,7 @@ class Parser(object):
# Iterate over each part
yield parse_boundary_stream(sub_stream, 1024)
def parse_header(line):
""" Parse the header into a key-value.
Input (line): bytes, output: unicode for key/name, bytes for value which
@@ -622,6 +630,7 @@ def parse_header(line):
pdict[name] = value
return key, pdict
def _parse_header_params(s):
plist = []
while s[:1] == b';':