diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2013-11-02 17:37:15 -0700 |
---|---|---|
committer | Jason Myers <jason@jasonamyers.com> | 2013-11-02 23:50:48 -0500 |
commit | 0fdb692c6c94d912f17a3e2ad12413fb072d38ec (patch) | |
tree | 08e58b879405d8d8bf2e8e873e5aee51e25d3b01 /django/http/multipartparser.py | |
parent | 8f85e734581d3c63905b991fc82fe05e7a1df709 (diff) | |
download | django-0fdb692c6c94d912f17a3e2ad12413fb072d38ec.tar.gz |
Fixed the remaining E302 violations int eh django package
Diffstat (limited to 'django/http/multipartparser.py')
-rw-r--r-- | django/http/multipartparser.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/django/http/multipartparser.py b/django/http/multipartparser.py index 28c0195a48..dcf2d1ae0d 100644 --- a/django/http/multipartparser.py +++ b/django/http/multipartparser.py @@ -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';': |