Skip to content

Commit

Permalink
try to make the linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
glyph committed Sep 19, 2024
1 parent f0a5148 commit 4fd3c84
Showing 1 changed file with 32 additions and 31 deletions.
63 changes: 32 additions & 31 deletions src/treq/_multipart.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,33 @@
Parser for multipart/form-data
==============================
This module provides a parser for the multipart/form-data format. It can read
from a file, a socket or a WSGI environment. The parser can be used to replace
This module provides a parser for the multipart/form-data format. It can read
from a file, a socket or a WSGI environment. The parser can be used to replace
cgi.FieldStorage to work around its limitations.
"""
"""
Copyright (c) 2010, Marcel Hellkamp.
Inspired by the Werkzeug library: http://werkzeug.pocoo.org/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""
..note::
__author__ = "Marcel Hellkamp"
__version__ = "0.2.5"
__license__ = "MIT"
__all__ = ["MultipartError", "MultipartParser", "MultipartPart", "parse_form_data"]
Copyright (c) 2010, Marcel Hellkamp.
Inspired by the Werkzeug library: http://werkzeug.pocoo.org/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""

import re
from io import BytesIO
Expand All @@ -47,6 +41,12 @@
from collections.abc import MutableMapping as DictMixin


__author__ = "Marcel Hellkamp"
__version__ = "0.2.5"
__license__ = "MIT"
__all__ = ["MultipartError", "MultipartParser", "MultipartPart", "parse_form_data"]


##############################################################################
################################ Helper & Misc ###############################
##############################################################################
Expand Down Expand Up @@ -369,10 +369,11 @@ def _iterparse(self):

class MultipartPart(object):
file: IO[bytes]

def __init__(self, buffer_size=2**16, memfile_limit=2**18, charset="latin1"):
self.headerlist = []
self.headers = None
self.file = False # type:ignore
self.file = False # type:ignore
self.size = 0
self._buf = b""
self.disposition = None
Expand Down Expand Up @@ -480,7 +481,7 @@ def save_as(self, path):
def close(self):
if self.file:
self.file.close()
self.file = False # type:ignore
self.file = False # type:ignore


##############################################################################
Expand Down

0 comments on commit 4fd3c84

Please sign in to comment.