/usr/local/lib/python3.6/site-packages/werkzeug/__pycache__
NameSizeModeActions
datastructures.cpython-36.pyc1077480644editdlrm
exceptions.cpython-36.pyc306390644editdlrm
filesystem.cpython-36.pyc20250644editdlrm
formparser.cpython-36.pyc138140644editdlrm
http.cpython-36.pyc379050644editdlrm
local.cpython-36.pyc226910644editdlrm
routing.cpython-36.pyc729310644editdlrm
security.cpython-36.pyc80400644editdlrm
serving.cpython-36.pyc304780644editdlrm
test.cpython-36.pyc389610644editdlrm
testapp.cpython-36.pyc95490644editdlrm
urls.cpython-36.pyc364140644editdlrm
useragents.cpython-36.pyc74170644editdlrm
user_agent.cpython-36.pyc17200644editdlrm
utils.cpython-36.pyc329600644editdlrm
wsgi.cpython-36.pyc301020644editdlrm
_internal.cpython-36.pyc182680644editdlrm
_reloader.cpython-36.pyc118990644editdlrm
__init__.cpython-36.pyc3100644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/werkzeug/__pycache__/formparser.cpython-36.pyc (13814B)
3 _TBgC@sddlZddlZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z dd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z yddl!m"Z"Wn&e#k r6ddl!m$Z$dZ"YnXej%r|ddlZ&ddl'm(Z(ej)ej*e+eefZ,Gddde&j-Z.ej/dej0dej1fdZ2ej*e+ddd d!Z3d:ej4e5ej4e6ej4e6ej4e5ej*e+d"d#d$Z7d;d(ej4de6e6ej4e5ej4e5ej4ej8ee9d)d* d+d,Z:e2e2d-d.d/Z;Gd0d1d1Ze+ed5d6d7Z?Gd8d9d9Z@dS)<N)update_wrapper)BytesIO)chain)Union) exceptions)_to_str) FileStorage)Headers) MultiDict)parse_options_header)Data)Epilogue)Field)File)MultipartDecoder)NeedData)url_decode_stream)_make_chunk_iter)get_content_length)get_input_stream)SpooledTemporaryFile) TemporaryFile)WSGIEnvironmentc@sBeZdZdejeejeejeejeejedddZ dS)TStreamFactoryN)total_content_length content_typefilenamecontent_lengthreturncCsdS)N)selfrrrrr r 7/tmp/pip-build-0s3hx122/Werkzeug/werkzeug/formparser.py__call__)szTStreamFactory.__call__)N) __name__ __module__ __qualname__tOptionalintstrIObytesr#r r r r"r(s"rF.)Zbound)streamrcCs"|jd}x|r|jd}q WdS)N@iii)read)r.Zbtsr r r"_exhaust6s r1)rrrrrcCsRd}tdk r&tjtjtt|ddS|dks6||krLtjtjttdStS)Niizrb+)max_sizemodei)rr'castr+r,rr)rrrrr2r r r"default_stream_factory<s r5utf-8replaceTrt_parse_result) environstream_factorycharseterrorsmax_form_memory_sizemax_content_lengthclssilentrcCst|||||||j|S)aParse the form data in the environ and return it as tuple in the form ``(stream, form, files)``. You should only call this method if the transport method is `POST`, `PUT`, or `PATCH`. If the mimetype of the data transmitted is `multipart/form-data` the files multidict will be filled with `FileStorage` objects. If the mimetype is unknown the input stream is wrapped and returned as first argument, else the stream is empty. This is a shortcut for the common usage of :class:`FormDataParser`. Have a look at :doc:`/request_data` for more details. .. versionadded:: 0.5 The `max_form_memory_size`, `max_content_length` and `cls` parameters were added. .. versionadded:: 0.5.1 The optional `silent` flag was added. :param environ: the WSGI environment to be used for parsing. :param stream_factory: An optional callable that returns a new read and writeable file descriptor. This callable works the same as :meth:`Response._get_file_stream`. :param charset: The character set for URL and url encoded form data. :param errors: The encoding error behavior. :param max_form_memory_size: the maximum number of bytes to be accepted for in-memory stored form data. If the data exceeds the value specified an :exc:`~exceptions.RequestEntityTooLarge` exception is raised. :param max_content_length: If this is provided and the transmitted data is longer than this value an :exc:`~exceptions.RequestEntityTooLarge` exception is raised. :param cls: an optional dict class to use. If this is not specified or `None` the default :class:`MultiDict` is used. :param silent: If set to False parsing errors will not be caught. :return: A tuple in the form ``(stream, form, files)``. )FormDataParserparse_from_environ)r9r:r;r<r=r>r?r@r r r"parse_form_dataLs2rC)frcsfdd}ttjt|S)z@Helper decorator for methods that exhausts the stream on return.c sLz||f||St|dd}|dk r0|nx|jd}|s2Pq2WXdS)Nexhaustir/i)getattrr0)r!r.argskwargsrEchunk)rDr r"wrappers  zexhaust_stream..wrapper)rr'r4r-)rDrJr )rDr"exhaust_streams rKc @seZdZUdZdejdeeejeejeejeje e dddd Z eej eefejej dejeeejeej eefgd fd d d Zdd dddZdejeeejeejej eefd dddZeejeeejeej eefd dddZeejeeejeej eefd dddZeeedZej eej dejeeejeej eefgd ffdS)rAaThis class implements parsing of form data for Werkzeug. By itself it can parse multipart and url encoded form data. It can be subclassed and extended but for most mimetypes it is a better idea to use the untouched stream and expose it as separate attributes on a request object. .. versionadded:: 0.8 :param stream_factory: An optional callable that returns a new read and writeable file descriptor. This callable works the same as :meth:`Response._get_file_stream`. :param charset: The character set for URL and url encoded form data. :param errors: The encoding error behavior. :param max_form_memory_size: the maximum number of bytes to be accepted for in-memory stored form data. If the data exceeds the value specified an :exc:`~exceptions.RequestEntityTooLarge` exception is raised. :param max_content_length: If this is provided and the transmitted data is longer than this value an :exc:`~exceptions.RequestEntityTooLarge` exception is raised. :param cls: an optional dict class to use. If this is not specified or `None` the default :class:`MultiDict` is used. :param silent: If set to False parsing errors will not be caught. Nutf-8r7Tr)r:r;r<r=r>r?r@rcCsF|dkr t}||_||_||_||_||_|dkr6t}||_||_dS)N) r5r:r;r<r=r>r r?r@)r!r:r;r<r=r>r?r@r r r"__init__s zFormDataParser.__init__r8)mimetypeoptionsrcCs |jj|S)N)parse_functionsget)r!rNrOr r r"get_parse_funcszFormDataParser.get_parse_funcr)r9rcCs4|jdd}t|}t|\}}|jt||||S)zParses the information from the environment as form data. :param environ: the WSGI environment to be used for parsing. :return: A tuple in the form ``(stream, form, files)``. CONTENT_TYPE)rQrr parser)r!r9rrrNrOr r r"rBs  z!FormDataParser.parse_from_environ)r.rNrrOrc Cs|jdk r,|dk r,||jkr,t|tj|dkr8i}|j||}|dk rzy||||||Stk rx|jstYnX||j|jfS)aParses the information from the given stream, mimetype, content length and mimetype parameters. :param stream: an input stream :param mimetype: the mimetype of the data :param content_length: the content length of the incoming data :param options: optional mimetype parameters (used for the multipart boundary for instance) :return: A tuple in the form ``(stream, form, files)``. N)r>r1rRequestEntityTooLargerR ValueErrorr@r?)r!r.rNrrOZ parse_funcr r r"rUs   zFormDataParser.parsec CsVt|j|j|j|j|jd}|jddjd}|s:td|j |||\}}|||fS)N)r=r?boundaryrTasciizMissing boundary) MultiPartParserr:r;r<r=r?rQencoderWrU) r!r.rNrrOparserrXformfilesr r r"_parse_multiparts zFormDataParser._parse_multipartcCsP|jdk r,|dk r,||jkr,t|tjt||j|j|jd}|||jfS)N)r<r?)r=r1rrVrr;r<r?)r!r.rNrrOr]r r r"_parse_urlencoded's  z FormDataParser._parse_urlencoded)zmultipart/form-dataz!application/x-www-form-urlencodedzapplication/x-url-encoded)NrLr7NNNT)N)r$r%r&__doc__r'r(r*r)Typer boolrMDictCallabler+r,rRrBrUrKr_r`rPr r r r"rAs@ ."&"  rA)linercCsH|d ddkr |dd dfS|d dd kr@|dd dfS|dfS)z_Removes line ending characters and returns a tuple (`stripped_line`, `is_terminated`). Nz Tr  Frj>rhrirkr )rfr r r" _line_parseIs rl)iterablercCstjdtddg}x|D]}t|}t|\}}|s>td|sFPq|ddkr|r|d \}}||d|dd f|d <q|jd d}t|dkr|j|dj |dj fqWt |S) a@Parses multipart headers from an iterable that yields lines (including the trailing newline symbol). The iterable has to be newline terminated. The iterable will stop at the line where the headers ended so it can be further consumed. :param iterable: iterable of strings that are newline terminated zL'parse_multipart_headers' is deprecated and will be removed in Werkzeug 2.1.rg) stacklevelz*unexpected end of line in multipart headerrz rz N:rkrk) warningswarnDeprecationWarningrrlrWsplitlenappendstripr )rmresultZb_linerfZline_terminatedkeyvaluepartsr r r"parse_multipart_headersVs&      "r{c @seZdZdejdeeejeejejeedddd Z ed d d d Z e edddZ e ejeejedddZejeeejeejeefdddZdS)rZNutf-8r7r/ir)r:r;r<r=r? buffer_sizercCs@||_||_||_|dkrt}||_|dkr0t}||_||_dS)N)r;r<r=r5r:r r?r})r!r:r;r<r=r?r}r r r"rM}s zMultiPartParser.__init__z te.NoReturn)messagercCs t|dS)N)rW)r!r~r r r"failszMultiPartParser.fail)headersrcCs.|jd}|r(t|\}}|jd|jS|jS)Nz content-typer;)rQr r;)r!rrrNZ ct_paramsr r r"get_part_charsets   z MultiPartParser.get_part_charset)eventrrcCsT|jjd}yt|jd}Wnttfk r:d}YnX|j||j||d}|S)Nz content-typezcontent-lengthr)rrrr)rrQr)KeyErrorrWr:r)r!rrrr containerr r r"start_file_streamings  z$MultiPartParser.start_file_streaming)r.rXrrc CsRtt|||jddg}t||j}g}g}x|D]}|j||j} xt| tt fs8t| t rx| } g} | j } nt| t r| } |j | |} | j} nt| tr.| | j| js.t| t rdj| j|j| j|j} |j | j| fn>tjtjt| } | jd|j | jt| | j| j| jdf|j} qNWq4W|j||j|fS)N)limitr}r)r) rrr}rr=Z receive_dataZ next_event isinstancerrrrurrwriter dataZ more_datajoindecoderrr<namer'r4r+r,seekr rr?)r!r.rXriteratorr\fieldsr^rrZ current_partr_writeryr r r"rUsN          zMultiPartParser.parse)Nr|r7NNr)r$r%r&r'r(r*r)rbr rMrr rrr+r,rTuplerUr r r r"rZ|s& rZ)N)Nr6r7NNNT)AZtypingr'rp functoolsrior itertoolsrrrTrZ _internalrZdatastructuresr r r httpr Zsansio.multipartr rrrrrurlsrZwsgirrrtempfiler ImportErrorrZ TYPE_CHECKINGteZ_typeshed.wsgirrr+r,r8ZProtocolrZTypeVarreZAnyr-r1r(r)r*r5rbrcrCrKrArlIterabler{rZr r r r"sb                         " 04, &