/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__/test.cpython-36.pyc (38961B)
3 _TBgk @sddlZddlZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZddlmZdd lmZdd lmZdd lmZd d lmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlm Z d dlm!Z!d dlm"Z"d dl#m$Z$d dl#m%Z%d dl#m&Z&d dl'm(Z(d dl'm)Z)d dl'm*Z*d dl'm+Z+d dl'm,Z,d d l'm-Z-d d!l.m/Z/d d"l.m0Z0d d#l.m1Z1d d$l.m2Z2d d%l.m3Z3d d&l.m4Z4d d'l5m6Z6d d l7mZd d(l8m9Z9d d)l:m;Z;d d*l:mm?Z?dd,l>m@Z@dTejAeBejCfeDeEejFeBeBejGejHeIeEeBfd1d2d3ZJdUejAeBejCfejFeBeBejGeBeIfd4d5d6ZKGd7d8d8ZLGd9d:d:ZMGd;d<dd?ZPejQd@e"dAZRGdBdCdCZSGdDdEdEeTZUGdFdGdGZVejCejCdHdIdJdKZWdVdMdHeDejGejXeIeBe!fdNdOdPZYGdQdRdRe9ZZdS)WN) defaultdict)datetime) timedelta) CookieJar)BytesIO)chain)random) TemporaryFile)time)Request) _get_environ)_make_encode_wrapper)_wsgi_decoding_dance)_wsgi_encoding_dance) Authorization) CallbackDict)CombinedMultiDict)EnvironHeaders) FileMultiDict)Headers) MultiDict) dump_cookie)dump_options_header)parse_options_header)Data)Epilogue)Field)File)MultipartEncoder)Preamble) iri_to_uri) url_encode)url_fix) url_parse) url_unparse) url_unquote)get_content_type)Response)ClosingIterator)get_current_url)WSGIApplication)WSGIEnvironmentTiiutf-8)data use_tempfile thresholdboundarycharsetreturncs|dkrdtt}tdd|rHttdfdd }nj}t|j}||jt dd x*t |D]\}}t |d d} | dk rPt |d t |d d} t |d d} | dkr| rt j | dpd} td| fg} | dkr||jt|| dn||jt|| | dxv| d} | s2P||jt| ddq"Wqzt|tsdt|}||jt|td||jt|j|ddqzW||jtdd j}jd||fS)zEncode a dict of values (either strings or file descriptors or :class:`FileStorage` objects.) into a multipart encoded string stored in a file descriptor. Nz ---------------WerkzeugFormPart_rF)sr3cstrj|St|}|kr.j|n6tjtjttd}|jj|j||d|7|SdS)Nzwb+T)writelentcastIObytesr getvalue)r4lengthZ new_stream)on_diskstreamr0 total_length1/tmp/pip-build-0s3hx122/Werkzeug/werkzeug/test.py write_binaryIs    z-stream_encode_multipart..write_binary)r.readfilenamename content_typezapplication/octet-streamz Content-Type)rFheaders)rFrErHi@T)r.Z more_data)r rrr:intr5rencodeZ send_eventr _iter_datagetattr mimetypes guess_typerrrr isinstancestrrtellseek)r.r/r0r1r2rBencoderkeyvaluereaderrErGrHchunkr<r@)r=r>r0r?rAstream_encode_multipart5sN        rX)valuesr1r2r3cCs"t|d||d\}}}||jfS)zuLike `stream_encode_multipart` but returns a tuple in the form (``boundary``, ``data``) where data is bytes. F)r/r1r2)rXrD)rYr1r2r>r<r@r@rAencode_multipartsrZc@sveZdZdZejeejeje e ffddddZ e ej e dddZ d e ej ej e ej e d d d ZdS) _TestCookieHeaderszA headers adapter for cookielibN)rHr3cCs ||_dS)N)rH)selfrHr@r@rA__init__sz_TestCookieHeaders.__init__)rFr3cCs:g}|j}x(|jD]\}}|j|kr|j|qW|S)N)lowerrHappend)r\rFrHkvr@r@rA getheaderss  z_TestCookieHeaders.getheaders)rFdefaultr3cCs|j|}|s|S|S)N)rb)r\rFrcrHr@r@rAget_alls z_TestCookieHeaders.get_all)N)__name__ __module__ __qualname____doc__r7UnionrListTuplerPr]IterablerbOptionalrdr@r@r@rAr[s * r[c@sHeZdZdZejeejeje e ffddddZ e dddZ dS) _TestCookieResponsezSomething that looks like a httplib.HTTPResponse, but is actually just an adapter for our test responses to make them available for cookielib. N)rHr3cCst||_dS)N)r[rH)r\rHr@r@rAr]sz_TestCookieResponse.__init__)r3cCs|jS)N)rH)r\r@r@rAinfosz_TestCookieResponse.info) rerfrgrhr7rirrjrkrPr]r[ror@r@r@rArns*rnc@sLeZdZdZdddddZdejeejej e e ffdddd Z dS) _TestCookieJarzA cookielib.CookieJar modified to inject and read cookie headers from and to wsgi environments, and wsgi application responses. r,N)environr3cCs2dd|D}|r"dj||d<n |jdddS)zYInject the cookies as client headers into the server's wsgi environment. cSsg|]}|jd|jqS)=)rFrU).0cr@r@rA sz._TestCookieJar.inject_wsgi..z; Z HTTP_COOKIEN)joinpop)r\rqZcvalsr@r@rA inject_wsgisz_TestCookieJar.inject_wsgi)rqrHr3cCs|jt|tt|dS)zXExtract the server's set-cookie headers as cookies into the cookie jar. N)extract_cookiesrn_UrllibRequestr*)r\rqrHr@r@rA extract_wsgisz_TestCookieJar.extract_wsgi) rerfrgrhrxr7rirrjrkrPr{r@r@r@rArps  rp)r.r3ccsft|tr|jddEdHnDxB|jD]6\}}t|trTx"|D]}||fVq@Wq(||fVq(WdS)zIterate over a mapping that might have a list of values, yielding all key, value pairs. Almost like iter_multi_items but only allows lists, not tuples, of values so tuples can be used for files. T)ZmultiN)rOritemslist)r.rTrUrar@r@rArKs   rK_TAnyMultiDict)Zboundc@seZdZUdZdZddfZeZddlZe ej Z [e j ee j ee j e jee j ee j edddddddddddddddd dddfee j ee j e je jeefefee j e jee j ee j ee j e jeeeee j e jee je jeeffe j e je jeeee jee jffe j e jee jfe j e jee jfee j ee j e jee jfe j e je e jeeffdd d d Z!e"d e jddddZ#ee je jee je jeefe je jeeeffddddZ$e eeeedddZ%e&edddZ'e'j(e j eddddZ'e&e j edddZ)e)j(e j eddddZ)e&e j eddd Z*e*j(eddd!d Z*e&e jeefdd"d#Z+e&e j edd$d%Z,e,j(e j eddd&d%Z,ee j-e.e.d'd(d)Z/eedd*d+d,Z0e&edd-d.Z1e1j(eddd/d.Z1e&edd0d1Z2e2j(eddd2d1Z2e&e j e jedd3d4Z3e3j(e j e jeddd5d4Z3e&edd6d7Z4e4j(e j eddd8d7Z4e&edd9d:Z5e5j(e j eddd;d:Z5e&eddd?Z7ddd@dAZ8dddBdCZ9d ddDdEZ:dfe j e j-eedFdGdHZ;dS)IEnvironBuilderaThis class can be used to conveniently create a WSGI environment for testing purposes. It can be used to quickly create WSGI environments or request objects from arbitrary data. The signature of this class is also used in some other places as of Werkzeug 0.5 (:func:`create_environ`, :meth:`Response.from_values`, :meth:`Client.open`). Because of this most of the functionality is available through the constructor alone. Files and regular form data can be manipulated independently of each other with the :attr:`form` and :attr:`files` attributes, but are passed with the same argument to the constructor: `data`. `data` can be any of these values: - a `str` or `bytes` object: The object is converted into an :attr:`input_stream`, the :attr:`content_length` is set and you have to provide a :attr:`content_type`. - a `dict` or :class:`MultiDict`: The keys have to be strings. The values have to be either any of the following objects, or a list of any of the following objects: - a :class:`file`-like object: These are converted into :class:`FileStorage` objects automatically. - a `tuple`: The :meth:`~FileMultiDict.add_file` method is called with the key and the unpacked `tuple` items as positional arguments. - a `str`: The string is set as form data for the associated key. - a file-like object: The object content is loaded in memory and then handled like a regular `str` or a `bytes`. :param path: the path of the request. In the WSGI environment this will end up as `PATH_INFO`. If the `query_string` is not defined and there is a question mark in the `path` everything after it is used as query string. :param base_url: the base URL is a URL that is used to extract the WSGI URL scheme, host (server name + server port) and the script root (`SCRIPT_NAME`). :param query_string: an optional string or dict with URL parameters. :param method: the HTTP method to use, defaults to `GET`. :param input_stream: an optional input stream. Do not specify this and `data`. As soon as an input stream is set you can't modify :attr:`args` and :attr:`files` unless you set the :attr:`input_stream` to `None` again. :param content_type: The content type for the request. As of 0.5 you don't have to provide this when specifying files and form data via `data`. :param content_length: The content length for the request. You don't have to specify this when providing data via `data`. :param errors_stream: an optional error stream that is used for `wsgi.errors`. Defaults to :data:`stderr`. :param multithread: controls `wsgi.multithread`. Defaults to `False`. :param multiprocess: controls `wsgi.multiprocess`. Defaults to `False`. :param run_once: controls `wsgi.run_once`. Defaults to `False`. :param headers: an optional list or :class:`Headers` object of headers. :param data: a string or dict of form data or a file-object. See explanation above. :param json: An object to be serialized and assigned to ``data``. Defaults the content type to ``"application/json"``. Serialized with the function assigned to :attr:`json_dumps`. :param environ_base: an optional dict of environment defaults. :param environ_overrides: an optional dict of environment overrides. :param charset: the charset used to encode string data. :param auth: An authorization object to use for the ``Authorization`` header value. A ``(username, password)`` tuple is a shortcut for ``Basic`` authorization. .. versionchanged:: 2.0 ``REQUEST_URI`` and ``RAW_URI`` is the full raw URI including the query string, not only the path. .. versionchanged:: 2.0 The default :attr:`request_class` is ``Request`` instead of ``BaseRequest``. .. versionadded:: 2.0 Added the ``auth`` parameter. .. versionadded:: 0.15 The ``json`` param and :meth:`json_dumps` method. .. versionadded:: 0.15 The environ has keys ``REQUEST_URI`` and ``RAW_URI`` containing the path before perecent-decoding. This is not part of the WSGI PEP, but many WSGI servers include it. .. versionchanged:: 0.6 ``path`` and ``base_url`` can now be unicode strings that are encoded with :func:`iri_to_uri`. zHTTP/1.1r rN/GETFzutf-8)pathbase_url query_stringmethod input_streamrGcontent_length errors_stream multithread multiprocessrun_oncerHr. environ_baseenviron_overridesr2mimetypejsonauthr3cCst|}|dk r$|d|kr$tdt|}|dkrF|d|krF|j}||_t|j|_||_|dk rvtt|||}||_ t |t t fr||_ n(|dkrt}nt |tst|}||_||_| dkrt} nt | tst| } | |_|dk r||_|dkrtj}||_| |_| |_| |_||_||_||_||_d|_|dk r|t |trjt d|d|dd}|jj!d|j"|dk r| dk rt#d |j$|} |jdkrd |_| rz|dk rt#d t%| d r| j&} t | t r| j'|j} t | t r&t(| |_|jdkrzt)| |_nTxRt*| D]F\}}t |tt+fsTt%|d rb|j,||n|j-j.|j/|q0W|dk r||_0dS) N?z6Query string is defined in the path and as an argumentFbasicrr )usernamepasswordrz can't provide both json and datazapplication/jsonz#can't provide input stream and datarD)1r ValueErrorr$queryr2r!r request_urir#rrOr:rPrrargsrrrHrGsysstderrrrrrrrrrclosedtuplersetZ to_header TypeError json_dumpshasattrrDrJrr6rKdict_add_file_from_dataformZsetlistdefaultr_r)r\rrrrrrGrrrrrrHr.rrr2rrrZpath_srrTrUr@r@rAr]bs                   zEnvironBuilder.__init__r,)rqkwargsr3c Kstt|}t|d|j|d|jdt|dt|d|d|d|jdd |jd d |d |d |d |d|d }|j||f|S)a-Turn an environ dict back into a builder. Any extra kwargs override the args extracted from the environ. .. versionchanged:: 2.0 Path and query values are passed through the WSGI decoding dance to avoid double encoding. .. versionadded:: 0.15 PATH_INFOzwsgi.url_schemeHost SCRIPT_NAME QUERY_STRINGREQUEST_METHODz wsgi.inputz Content-TypeNzContent-Lengthz wsgi.errorszwsgi.multithreadzwsgi.multiprocessz wsgi.run_once) rrrrrrGrrrrrrH)rrr_make_base_urlrwupdate)clsrqrrHoutr@r@rA from_environs$       zEnvironBuilder.from_environ)rTrUr3cCs0t|tr|jj|f|n|jj||dS)z=Called in the EnvironBuilder to add files from the data dict.N)rOrfilesZadd_file)r\rTrUr@r@rArs z"EnvironBuilder._add_file_from_data)schemehost script_rootr3cCst|||ddfjddS)Nr)r%rstrip)rrrr@r@rArszEnvironBuilder._make_base_url)r3cCs|j|j|j|jS)z`The base URL is used to extract the URL scheme, host name, port, and root path. )r url_schemerr)r\r@r@rArszEnvironBuilder.base_url)rUr3cCsT|dkrd}d}d}n"t|\}}}}}|s0|r8td|jd|_||_||_dS)Nhttp localhostrz4base url must not contain a query string or fragmentr)r$rrrrr)r\rUrnetlocrqsanchorr@r@rArs cCs8|jjd}|dkr4|j r4|jr&dS|jr0dSdS|S)zThe content type for the request. Reflected from and to the :attr:`headers`. Do not set if you set :attr:`files` or :attr:`form` for auto detection. z Content-TypeNzmultipart/form-dataz!application/x-www-form-urlencoded)rHget _input_stream_files_form)r\ctr@r@rArGs zEnvironBuilder.content_typecCs&|dkr|jjddn ||jd<dS)Nz Content-Type)rHrw)r\rUr@r@rArG scCs |j}|r|jddjSdS)zYThe mimetype (content type without charset etc.) .. versionadded:: 0.14 ;rN)rGsplitstrip)r\rr@r@rAr'szEnvironBuilder.mimetypecCst||j|_dS)N)r'r2rG)r\rUr@r@rAr0scs4tddfdd }tjjddd}t||S)zThe mimetype parameters as dict. For example if the content type is ``text/html; charset=utf-8`` the params would be ``{'charset': 'utf-8'}``. .. versionadded:: 0.14 N)dr3cstj|jd<dS)Nz Content-Type)rrrH)r)r\r@rA on_update=sz1EnvironBuilder.mimetype_params..on_updatez content-typerr )rrrHr)r\rrr@)r\rAmimetype_params4s zEnvironBuilder.mimetype_paramscCs|jjdtdS)zThe content length as integer. Reflected from and to the :attr:`headers`. Do not set if you set :attr:`files` or :attr:`form` for auto detection. zContent-Length)type)rHrrI)r\r@r@rArCszEnvironBuilder.content_lengthcCs*|dkr|jjddnt||jd<dS)NzContent-Length)rHrwrP)r\rUr@r@rArKs)rFstorager3cCs:|jdk rtdt||}|dkr6|}t||||S)zCommon behavior for getting the :attr:`form` and :attr:`files` properties. :param name: Name of the internal cached attribute. :param storage: Storage class used for the data. Nzan input stream is defined)rAttributeErrorrLsetattr)r\rFrrvr@r@rA _get_formRs   zEnvironBuilder._get_form)rFrUr3cCsd|_t|||dS)zCommon behavior for setting the :attr:`form` and :attr:`files` properties. :param name: Name of the internal cached attribute. :param value: Value to assign to the attribute. N)rr)r\rFrUr@r@rA _set_formdszEnvironBuilder._set_formcCs |jdtS)z$A :class:`MultiDict` of form values.r)rr)r\r@r@rArnszEnvironBuilder.formcCs|jd|dS)Nr)r)r\rUr@r@rArsscCs |jdtS)zrA :class:`FileMultiDict` of uploaded files. Use :meth:`~FileMultiDict.add_file` to add new files. r)rr)r\r@r@rArwszEnvironBuilder.filescCs|jd|dS)Nr)r)r\rUr@r@rAr~scCs|jS)zAn optional input stream. This is mutually exclusive with setting :attr:`form` and :attr:`files`, setting it will clear those. Do not provide this if the method is not ``POST`` or another method that has a body. )r)r\r@r@rArszEnvironBuilder.input_streamcCs||_d|_d|_dS)N)rrr)r\rUr@r@rArscCs.|jdkr(|jdk r$t|j|jdSdS|jS)ziThe query string. If you set this to a string :attr:`args` will no longer be available. N)r2r) _query_string_argsr"r2)r\r@r@rArs   zEnvironBuilder.query_stringcCs||_d|_dS)N)rr)r\rUr@r@rArscCs*|jdk rtd|jdkr$t|_|jS)z(The URL arguments as :class:`MultiDict`.Nza query string is defined)rrrr)r\r@r@rArs   zEnvironBuilder.argscCsd|_||_dS)N)rr)r\rUr@r@rArscCs|jjdddS)z4The server name (read-only, use :attr:`host` to set):r r)rr)r\r@r@rA server_nameszEnvironBuilder.server_namecCsD|jjdd}t|dkr2|djr2t|dS|jdkr@dSdS)z?The server port as integer (read-only, use :attr:`host` to set)rr httpsiP)rrr6isdigitrIr)r\piecesr@r@rA server_ports   zEnvironBuilder.server_portc Cs&y |jWntk r YnXdS)N)close Exception)r\r@r@rA__del__s zEnvironBuilder.__del__cCsl|jr dSy|jj}Wntk r0f}YnXx.|D]&}y |jWq8tk r\Yq8Xq8Wd|_dS)zCloses all files. If you put real :class:`file` objects into the :attr:`files` dict you can call this method to automatically close them all in one go. NT)rrrYrrr)r\rfr@r@rArs    zEnvironBuilder.closecsj}j}j}j}|dk rP|j}|jdd|j}|j|||}np|dkrttjj gj d\}}}|d|d}n6|dkrt jj dj d }t |}t|}nt}i} jr| jjttd fd d } tjj } | jj| j| jtjj | | jtjjjjj|jjj j!d j"j#} |dk r~|| d<| j$d||dk rt|| d<| j$d|t%t&} x6| j'D]*\}}| d|j(j)ddj*|qWx$| j+D]\}}dj,|| |<qWj-r| jj-| S)zReturn the built environ. .. versionchanged:: 0.15 The content type and length headers are set based on input stream detection. Previously this only set the WSGI keys. Nrrzmultipart/form-data)r2z ; boundary=""z!application/x-www-form-urlencodedascii)xr3cstt|jjS)N)rr&r2)r)r\r@rA _path_encodesz0EnvironBuilder.get_environ.._path_encode)rrrrZ REQUEST_URIZRAW_URIZ SERVER_NAMEZ SERVER_PORTZ HTTP_HOSTZSERVER_PROTOCOLz wsgi.versionzwsgi.url_schemez wsgi.inputz wsgi.errorszwsgi.multithreadzwsgi.multiprocessz wsgi.run_once CONTENT_TYPEz Content-TypeCONTENT_LENGTHzContent-LengthZHTTP_-_z, ).rrrrGrQrRrXrrrr2r"rJr6rrrrPrrrrrrrrrserver_protocol wsgi_versionrrrrrrHcopyrrr}Z to_wsgi_listupperreplacer_r|rvr)r\rrrrGZ start_posZend_posr1Z form_encodedresultrZraw_urirHZcombined_headersrTrUrYr@)r\rA get_environsr             & zEnvironBuilder.get_environ)rr3cCs|dkr|j}||jS)zReturns a request with the data. If the request class is not specified :attr:`request_class` is used. :param cls: The request wrapper to use. N) request_classr)r\rr@r@rA get_request-szEnvironBuilder.get_request)r r)r$locationrrrequestrqrrrrr6r RuntimeErrorrr status_coderrrrGrrHrwopen) r\r r rrrrrbuilderZ to_name_partsZfrom_name_parts path_partsZ root_partsr@r@rAresolve_redirects<         zClient.resolve_redirect)as_tupler follow_redirects)rrr rrr3c Ospd}| rZt|dkrZ|d}t|tr2|j}n(t|trLtj|j}nt|trZ|}|dkrt||}z |j}Wd|jX|j|j |d} |j | d|i} t } g} x|o| j dkr2|s| j | j| j| j f} | | krtd | j d | jd| j| t| | _| j| |j| |d} qWt| | _| j|jj|rltjdtdd|j | fS| S)aGenerate an environ dict from the given arguments, make a request to the application using it, and return the response. :param args: Passed to :class:`EnvironBuilder` to create the environ for the request. If a single arg is passed, it can be an existing :class:`EnvironBuilder` or an environ dict. :param buffered: Convert the iterator returned by the app into a list. If the iterator has a ``close()`` method, it is called automatically. :param follow_redirects: Make additional requests to follow HTTP redirects until a non-redirect status is returned. :attr:`TestResponse.history` lists the intermediate responses. .. versionchanged:: 2.0 ``as_tuple`` is deprecated and will be removed in Werkzeug 2.1. Use :attr:`TestResponse.request` and ``request.environ`` instead. .. versionchanged:: 2.0 The request input stream is closed when calling ``response.close()``. Input streams for redirects are automatically closed. .. versionchanged:: 0.5 If a dict is provided as file in the dict for the ``data`` parameter the content type has to be called ``content_type`` instead of ``mimetype``. This change was made for consistency with :class:`werkzeug.FileWrapper`. .. versionchanged:: 0.5 Added the ``follow_redirects`` parameter. Nr r)r r-./134zLoop detected: A z redirect to z was already made.zh'as_tuple' is deprecated and will be removed in Werkzeug 2.1. Access 'response.request.environ' instead.r) stacklevel>rrrrrr)r6rOrrrrr rr rqrrrZ make_sequencerraddrhistoryr_rZ call_on_closerwarningswarnDeprecationWarning) r\rr rrrrargrr Z redirectsr"Znew_redirect_entryr@r@rArsZ)               z Client.open)rkwr3cOsd|d<|j||S)z1Call :meth:`open` with ``method`` set to ``GET``.rr)r)r\rr'r@r@rArhsz Client.getcOsd|d<|j||S)z2Call :meth:`open` with ``method`` set to ``POST``.POSTr)r)r\rr'r@r@rApostmsz Client.postcOsd|d<|j||S)z1Call :meth:`open` with ``method`` set to ``PUT``.PUTr)r)r\rr'r@r@rAputrsz Client.putcOsd|d<|j||S)z4Call :meth:`open` with ``method`` set to ``DELETE``.DELETEr)r)r\rr'r@r@rAdeletewsz Client.deletecOsd|d<|j||S)z3Call :meth:`open` with ``method`` set to ``PATCH``.PATCHr)r)r\rr'r@r@rApatch|sz Client.patchcOsd|d<|j||S)z5Call :meth:`open` with ``method`` set to ``OPTIONS``.OPTIONSr)r)r\rr'r@r@rAoptionsszClient.optionscOsd|d<|j||S)z2Call :meth:`open` with ``method`` set to ``HEAD``.rr)r)r\rr'r@r@rAheadsz Client.headcOsd|d<|j||S)z3Call :meth:`open` with ``method`` set to ``TRACE``.TRACEr)r)r\rr'r@r@rAtracesz Client.trace)r3cCsdt|jd|jdS)N< >)rrer)r\r@r@rA__repr__szClient.__repr__)NTF) rNNrNFFNr)rNFFN)F)F)"rerfrgrhr7rmrrr]rPrirrIrfloatrrrkrlr:rr rrrrr)r+r-r/r1r2r4r8r@r@r@rAr?sNH @jrr,)rrr3c Os"t||}z|jS|jXdS)aCreate a new WSGI environ dict based on the values passed. The first parameter should be the path of the request which defaults to '/'. The second one can either be an absolute path (in that case the host is localhost:80) or a full path to the request with scheme, netloc port and the path to the script. This accepts the same arguments as the :class:`EnvironBuilder` constructor. .. versionchanged:: 0.5 This function is now a thin wrapper over :class:`EnvironBuilder` which was added in 0.5. The `headers`, `environ_base`, `environ_overrides` and `charset` parameters were added. N)rrr)rrrr@r@rArs rFr+)apprqr r3c st|j}dgdfdd }|||}t|dd}t|}|rfz t|}Wd|dk rb|XnJx |D]}j|dk rlPqlWrt|}|dk r||k rt||}\}} ||t| fS)aReturn a tuple in the form (app_iter, status, headers) of the application output. This works best if you pass it an application that returns an iterator all the time. Sometimes applications may use the `write()` callable returned by the `start_response` function. This tries to resolve such edge cases automatically. But if you don't get the expected output you should set `buffered` to `True` which enforces buffering. If passed an invalid WSGI application the behavior of this function is undefined. Never pass non-conforming WSGI applications to this function. :param app: the application to execute. :param buffered: set to `True` to enforce buffering. :return: tuple in the form ``(app_iter, status, headers)`` Nc s0|r"z|dj|dWdd}X||fjS)Nr r)with_tracebackr_)statusrHexc_info)bufferr r@rAstart_responses z$run_wsgi_app..start_responser)N) r rrLiterr}r_rr)r) r:rqr r?Zapp_rvZ close_funcZapp_iteritemr<rHr@)r>r rAr s,         r c szeZdZUdZeejddZ ffej e e e eejdejddfdd Zejdd d Zeejd d d ZZS)ra:class:`~werkzeug.wrappers.Response` subclass that provides extra information about requests made with the test :class:`Client`. Test client requests will always return an instance of this class. If a custom response class is passed to the client, it is subclassed along with this to support test information. If the test request included large files, or if the application is serving a file, call :meth:`close` to close any open files and prevent Python showing a ``ResourceWarning``. .FN)r r<rHrr"rr3c s0tj|||f|||_||_|||f|_dS)N)superr]rr" _compat_tuple)r\r r<rHrr"r) __class__r@rAr] s zTestResponse.__init__)r3cCstjdtddt|jS)NzThe test client no longer returns a tuple, it returns a 'TestResponse'. Tuple unpacking is deprecated and will be removed in Werkzeug 2.1. Access the attributes 'data', 'status', and 'headers' instead.r)r )r#r$r%r@rC)r\r@r@rA__iter__s zTestResponse.__iter__)rAr3cCstjdtdd|j|S)NzThe test client no longer returns a tuple, it returns a 'TestResponse'. Item indexing is deprecated and will be removed in Werkzeug 2.1. Access the attributes 'data', 'status', and 'headers' instead.r)r )r#r$r%rC)r\rAr@r@rA __getitem__(s zTestResponse.__getitem__)r.)rerfrgrhr rr7rkr"Z__test__rlr:rPrrr]IteratorrErIrF __classcell__r@r@)rDrArs   r)TrINr-)Nr-)F)[rMrZtypingr7r# collectionsrrrhttp.cookiejarrior itertoolsrrtempfiler r urllib.requestr rzZ _internalr rrrZdatastructuresrrrrrrrrrrrZsansio.multipartrrrrrr urlsr!r"r#r$r%r&utilsr'Zwrappers.requestZwrappers.responser(Zwsgir)r*Z TYPE_CHECKINGZ_typeshed.wsgir+r,rrPrrrIrmrkr9r:rXrZr[rnrprGrKZTypeVarr~rrrrrrlr rr@r@r@rAs                                            S  .MW F