U aH@sUdZddlZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z ddl mZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddl m!Z!ddl m"Z"ddl m#Z#ddl m$Z$ddl%m&Z&ddl%m'Z'ddl(m)Z)ej*rddl+Z,ddl-m.Z.ddl-m/Z/ddl0m1Z1e2dej3Z4e2dZ5e2d ej3Z6dd!d"d#Z7e8ej9de:e;eej>ej?e8ej@ffd'd(d)ZAe8ejBej>ejCe8ejCe8e8fd*d+d,ZDGd-d.d.eEZFGd/d0d0eeFZGGd1d2d2eFZHGd3d4d4eFZIGd5d6d6eFeJZKGd7d8d8eZLGd9d:d:eMZNGd;d<d<ZOGd=d>d>eOZPGd?d@d@eOZQGdAdBdBeOZRGdCdDdDZSGdEdFdFeOZTe8ejUdGdHdIZVdJZWdKZXeVeXZYeVdLeVdMfZZGdNdOdOeOZ[GdPdQdQZ\GdRdSdSe\Z]GdTdUdUe\Z^GdVdWdWe\Z_GdXdYdYe\Z`GdZd[d[e`ZaGd\d]d]e`ZbGd^d_d_e\Zce]e]e^e_eaebecd`Zdejee8ejfe\fegda<GdbdcdcZhGdddedeZidS)faq When it comes to combining multiple controller or view functions (however you want to call them) you need a dispatcher. A simple way would be applying regular expression tests on the ``PATH_INFO`` and calling registered callback functions that return the value then. This module implements a much more powerful system than simple regular expression matching because it can also convert values in the URLs and build URLs. Here a simple example that creates a URL map for an application with two subdomains (www and kb) and some URL rules: .. code-block:: python m = Map([ # Static URLs Rule('/', endpoint='static/index'), Rule('/about', endpoint='static/about'), Rule('/help', endpoint='static/help'), # Knowledge Base Subdomain('kb', [ Rule('/', endpoint='kb/index'), Rule('/browse/', endpoint='kb/browse'), Rule('/browse//', endpoint='kb/browse'), Rule('/browse//', endpoint='kb/browse') ]) ], default_subdomain='www') If the application doesn't use subdomains it's perfectly fine to not set the default subdomain and not use the `Subdomain` rule factory. The endpoint in the rules can be anything, for example import paths or unique identifiers. The WSGI application can use those endpoints to get the handler for that URL. It doesn't have to be a string at all but it's recommended. Now it's possible to create a URL adapter for one of the subdomains and build URLs: .. code-block:: python c = m.bind('example.com') c.build("kb/browse", dict(id=42)) 'http://kb.example.com/browse/42/' c.build("kb/browse", dict()) 'http://kb.example.com/browse/' c.build("kb/browse", dict(id=42, page=3)) 'http://kb.example.com/browse/42/3' c.build("static/about") '/about' c.build("static/index", force_external=True) 'http://www.example.com/' c = m.bind('example.com', subdomain='kb') c.build("static/about") 'http://www.example.com/about' The first argument to bind is the server name *without* the subdomain. Per default it will assume that the script is mounted on the root, but often that's not the case so you can provide the real mount point as second argument: .. code-block:: python c = m.bind('example.com', '/applications/example') The third argument can be the subdomain, if not given the default subdomain is used. For more details about binding have a look at the documentation of the `MapAdapter`. And here is how you can match URLs: .. code-block:: python c = m.bind('example.com') c.match("/") ('static/index', {}) c.match("/about") ('static/about', {}) c = m.bind('example.com', '/', 'kb') c.match("/") ('kb/index', {}) c.match("/browse/42/23") ('kb/browse', {'id': 42, 'page': 23}) If matching fails you get a ``NotFound`` exception, if the rule thinks it's a good idea to redirect (for example because the URL was defined to have a slash at the end but the request was missing that slash) it will raise a ``RequestRedirect`` exception. Both are subclasses of ``HTTPException`` so you can use those errors as responses in the application. If matching succeeded but the URL rule was incompatible to the given method (for example there were only rules for ``GET`` and ``HEAD`` but routing tried to match a ``POST`` request) a ``MethodNotAllowed`` exception is raised. N)pformat)Template)Lock)CodeType) _encode_idna) _get_environ) _to_bytes)_to_str)_wsgi_decoding_dance) ImmutableDict) MultiDict)BadHost) BadRequest) HTTPException)MethodNotAllowed)NotFound)_fast_url_quote) url_encode)url_join) url_quote)cached_property)redirect)get_host)WSGIApplication)WSGIEnvironment)Responseao (?P[^<]*) # static rule data < (?: (?P[a-zA-Z_][a-zA-Z0-9_]*) # converter name (?:\((?P.*?)\))? # converter arguments \: # variable delimiter )? (?P[a-zA-Z_][a-zA-Z0-9_]*) # variable name > z <([^>]+)>z ((?P\w+)\s*=\s*)? (?P True|False| \d+.\d+| \d+.| \d+| [\w\d_.]+| [urUR]?(?P"[^"]*?"|'[^']*') )\s*, TF)NoneTrueFalsevaluereturnc Csz|tkrt|SttfD](}z||WStk r>YqXq|dd|ddkrr|ddkrr|dd}t|S)Nrrz"')_PYTHON_CONSTANTSintfloat ValueErrorstr)r!convertr*QC:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-1tps7o9u\werkzeug\routing.py _pythonizes $ r,)argstrr"cCsx|d7}g}i}t|D]P}|d}|dkr:|d}t|}|dsX||q|d}|||<qt||fS)N,Z stringvalr!name)_converter_args_refinditergroupr,appendtuple)r-argskwargsitemr!r/r*r*r+parse_converter_argss      r8ruler"c csd}t|}tj}t}||kr|||}|dkr4q|}|drTdd|dfV|d}|dpfd}||krtd|d||||d pd|fV|}q||kr||d} d | ksd | krtd |dd| fVdS) zParse a rule and return it as generator. Each iteration yields tuples in the form ``(converter, arguments, variable)``. If the converter is `None` it's a static url part, otherwise it's a dynamic one. :internal: rNZstaticvariable converterdefaultzvariable name z used twice.r5>._score_rulekey)r&map_rulesmax)rWror|r*rsr+rr:s zBuildError.closest_rulecCsd|jg}|jr(|d|jd|jrD|dt|j|d|jr|j|jjkr|jr|jjdk r|j|jjkr|dt|jjd|jjt |jj pdt |j }|r|d t|dn|d |jjd d |S) Nz!Could not build url for endpoint  ()z with values .z Did you mean to use methods ?r*z" Did you forget to specify values z Did you mean z instead?) rlrnr3rmsortedrtrzryunionrCdefaultskeysjoin)rWmessageZmissing_valuesr*r*r+__str__Ls8    zBuildError.__str__)N)rNrOrPrQr(r^rhrir_rVrrtrrrrar*r*rXr+rj$s  rjc@seZdZdZdS)WebsocketMismatchzThe only matched rule is either a WebSocket and the request is HTTP, or the rule is HTTP and the request is a WebSocket. NrMr*r*r*r+rjsrc@seZdZdZdS)ValidationErrorzValidation error. If a rule converter raises this exception the rule does not match the current URL and the next URL is tried. NrMr*r*r*r+rpsrc@s&eZdZdZdejddddZdS) RuleFactoryzAs soon as you have more complex URL setups it's a good idea to use rule factories to avoid repetitive tasks. Some of them are builtin, others can be added by subclassing `RuleFactory` and overriding `get_rules`. Maprprr"cCs tdS)zaSubclasses of `RuleFactory` have to override this method and return an iterable of rules.N)NotImplementedErrorrWrr*r*r+ get_rules|szRuleFactory.get_rulesN)rNrOrPrQr^Iterablerr*r*r*r+rvsrc@s>eZdZdZeejdddddZdejddd d Z dS) SubdomainaAll URLs provided by this factory have the subdomain set to a specific domain. For example if you want to use the subdomain for the current language this can be a good setup:: url_map = Map([ Rule('/', endpoint='#select_language'), Subdomain('', [ Rule('/', endpoint='index'), Rule('/about', endpoint='about'), Rule('/help', endpoint='help') ]) ]) All the rules except for the ``'#select_language'`` endpoint will now listen on a two letter long subdomain that holds the language code for the current request. rpN) subdomainrulesr"cCs||_||_dSrT)rr)rWrrr*r*r+rVszSubdomain.__init__rrccs6|jD]*}||D]}|}|j|_|VqqdSrT)rremptyrrWr rulefactoryr:r*r*r+rs  zSubdomain.get_rules rNrOrPrQr(r^rrVIteratorrr*r*r*r+rsrc@s>eZdZdZeejdddddZdejddd d Z dS) Submounta}Like `Subdomain` but prefixes the URL rule with a given string:: url_map = Map([ Rule('/', endpoint='index'), Submount('/blog', [ Rule('/', endpoint='blog/index'), Rule('/entry/', endpoint='blog/show') ]) ]) Now the rule ``'blog/show'`` matches ``/blog/entry/``. rpN)pathrr"cCs|d|_||_dS)N/)rstriprr)rWrrr*r*r+rVs zSubmount.__init__rrccs<|jD]0}||D] }|}|j|j|_|VqqdSrT)rrrrr:rr*r*r+rs  zSubmount.get_rulesrr*r*r*r+rs rc@s>eZdZdZeejdddddZdejddd d Z dS) EndpointPrefixaPrefixes all endpoints (which must be strings for this factory) with another string. This can be useful for sub applications:: url_map = Map([ Rule('/', endpoint='index'), EndpointPrefix('blog/', [Submount('/blog', [ Rule('/', endpoint='index'), Rule('/entry/', endpoint='show') ])]) ]) rpN)prefixrr"cCs||_||_dSrT)rr)rWrrr*r*r+rVszEndpointPrefix.__init__rrccs<|jD]0}||D] }|}|j|j|_|VqqdSrT)rrrrrlrr*r*r+rs  zEndpointPrefix.get_rulesrr*r*r*r+rs rc@s<eZdZdZejdddddZejejddd d ZdS) RuleTemplateaXReturns copies of the rules wrapped and expands string templates in the endpoint, rule, defaults or subdomain sections. Here a small example for such a rule template:: from werkzeug.routing import Map, Rule, RuleTemplate resource = RuleTemplate([ Rule('/$name/', endpoint='$name.list'), Rule('/$name/', endpoint='$name.show') ]) url_map = Map([resource(name='user'), resource(name='page')]) When a rule template is called the keyword arguments are used to replace the placeholders in all the string parameters. rpN)rr"cCst||_dSrT)listrrWrr*r*r+rVszRuleTemplate.__init__RuleTemplateFactory)r5r6r"cOst|jt||SrT)rrr`)rWr5r6r*r*r+__call__szRuleTemplate.__call__) rNrOrPrQr^rrVrirr*r*r*r+rsrc@sJeZdZdZejdejeejfddddZ dej ddd d Z dS) rzsA factory that fills in template variables into rules. Used by `RuleTemplate` internally. :internal: rpN)rcontextr"cCs||_||_dSrT)rr)rWrrr*r*r+rVszRuleTemplateFactory.__init__rrc cs|jD]}||D]}d}}|jr`i}|jD]*\}}t|trVt||j}|||<q4|j dk r|t|j |j}|j }t|trt||j}t t|j |j|||j |j||jVqqdSrT)rrritems isinstancer(r substituterrrlrpr:rz build_onlystrict_slashes) rWrrr:Z new_defaultsrr~r!Z new_endpointr*r*r+rs.     zRuleTemplateFactory.get_rules) rNrOrPrQr^rDictr(rirVrrr*r*r*r+rs$r)srcr"cCsPt|jd}t|tjr"|j}t|D]}t|tjr,d|j|_q,|S)zEast parse and prefix names with `.` to avoid collision with user varsrr) astparsebodyrZExprr!walkNameid)rtreenoder*r*r+ _prefix_namess  rz#self._converters[{elem!r}].to_url()z^if kwargs: q = '?' params = self._encode_query_vars(kwargs) else: q = params = '' qparamsc@seZdZdZd=eejejeejfejeejej ee ejeeje eje ejej eej deffe ejee dd ddZ ddd d Zejeejfdd d Zd ejddddZddddZd>d e ddddZeeejejeejfddddZejeejfedddZddddZd?eejeejejeejfdd d!Zeeeej dejeeffd"d#d$Zd@e ej dejeeffd&d'd(ZdAejeejfe ejejeefd)d*d+Zde d,d-d.ZdBejeejfejee d/d0d1Z eje e!ej eje!e!fe!ej e!fdd2d3Z"eje!e!e!fdd4d5Z#e$e d6d7d8Z%dZ&edd9d:Z'edd;d<Z(dS)CrpaA Rule represents one URL pattern. There are some options for `Rule` that change the way it behaves and are passed to the `Rule` constructor. Note that besides the rule-string all arguments *must* be keyword arguments in order to not break the application on Werkzeug upgrades. `string` Rule strings basically are just normal URL paths with placeholders in the format ```` where the converter and the arguments are optional. If no converter is defined the `default` converter is used which means `string` in the normal configuration. URL rules that end with a slash are branch URLs, others are leaves. If you have `strict_slashes` enabled (which is the default), all branch URLs that are matched without a trailing slash will trigger a redirect to the same URL with the missing slash appended. The converters are defined on the `Map`. `endpoint` The endpoint for this rule. This can be anything. A reference to a function, a string, a number etc. The preferred way is using a string because the endpoint is used for URL generation. `defaults` An optional dict with defaults for other rules with the same endpoint. This is a bit tricky but useful if you want to have unique URLs:: url_map = Map([ Rule('/all/', defaults={'page': 1}, endpoint='all_entries'), Rule('/all/page/', endpoint='all_entries') ]) If a user now visits ``http://example.com/all/page/1`` he will be redirected to ``http://example.com/all/``. If `redirect_defaults` is disabled on the `Map` instance this will only affect the URL generation. `subdomain` The subdomain rule string for this rule. If not specified the rule only matches for the `default_subdomain` of the map. If the map is not bound to a subdomain this feature is disabled. Can be useful if you want to have user profiles on different subdomains and all subdomains are forwarded to your application:: url_map = Map([ Rule('/', subdomain='', endpoint='user/homepage'), Rule('/stats', subdomain='', endpoint='user/stats') ]) `methods` A sequence of http methods this rule applies to. If not specified, all methods are allowed. For example this can be useful if you want different endpoints for `POST` and `GET`. If methods are defined and the path matches but the method matched against is not in this list or in the list of another rule for that path the error raised is of the type `MethodNotAllowed` rather than `NotFound`. If `GET` is present in the list of methods and `HEAD` is not, `HEAD` is added automatically. `strict_slashes` Override the `Map` setting for `strict_slashes` only for this rule. If not specified the `Map` setting is used. `merge_slashes` Override :attr:`Map.merge_slashes` for this rule. `build_only` Set this to True and the rule will never match but will create a URL that can be build. This is useful if you have resources on a subdomain or folder that are not handled by the WSGI application (like static data) `redirect_to` If given this must be either a string or callable. In case of a callable it's called with the url adapter that triggered the match and the values of the URL as keyword arguments and has to return the target for the redirect, otherwise it has to be a string with placeholders in rule syntax:: def foo_with_slug(adapter, id): # ask the database for the slug for the old id. this of # course has nothing to do with werkzeug. return f'foo/{Foo.get_slug_for_id(id)}' url_map = Map([ Rule('/foo/', endpoint='foo'), Rule('/some/old/url/', redirect_to='foo/'), Rule('/other/old/url/', redirect_to=foo_with_slug) ]) When the rule is matched the routing system will raise a `RequestRedirect` exception with the target for the redirect. Keep in mind that the URL will be joined against the URL root of the script so don't use a leading slash on the target URL unless you really mean root of that domain. `alias` If enabled this rule serves as an alias for another rule with the same endpoint and arguments. `host` If provided and the URL map has host matching enabled this can be used to provide a match rule for the whole host. This also means that the subdomain feature is disabled. `websocket` If ``True``, this rule is only matches for WebSocket (``ws://``, ``wss://``) requests. By default, rules will only match for HTTP requests. .. versionadded:: 1.0 Added ``websocket``. .. versionadded:: 1.0 Added ``merge_slashes``. .. versionadded:: 0.7 Added ``alias`` and ``host``. .. versionchanged:: 0.6.1 ``HEAD`` is added to ``methods`` if ``GET`` is present. NF.) stringrrrzrrlr merge_slashes redirect_toaliashost websocketr"c Cs|dstd||_|d |_d|_||_||_||_| |_ ||_ ||_ | |_ | |_ |dk rt|trvtddd|D}d|krd|kr|d| r|dddhrtd ||_||_| |_|rttt||_nt|_g|_dS) Nrz$urls must start with a leading slashz&'methods' should be a list of strings.cSsh|] }|qSr*)upper.0xr*r*r+ sz Rule.__init__..HEADGETOPTIONSzBWebSocket rules can only use 'GET', 'HEAD', and 'OPTIONS' methods.) startswithr'r:endswithis_leafrrrrrrrrrrr( TypeErrorrErzrlrrCry_trace) rWrrrrzrrlrrrrrrr*r*r+rVs<   z Rule.__init__rqcCst||jf|S)z Return an unbound copy of this rule. This can be useful if want to reuse an already bound URL for another map. See ``get_empty_kwargs`` to override what keyword arguments are provided to the new copy. )typer:get_empty_kwargsrsr*r*r+rsz Rule.emptyc Cs>d}|jrt|j}t||j|j|j|j|j|j|j|j d S)a Provides kwargs for instantiating empty copy with empty() Use this method to provide custom keyword arguments to the subclass of ``Rule`` when calling ``some_rule.empty()``. Helpful when the subclass has custom keyword arguments that are needed at instantiation. Must return a ``dict`` that will be provided as kwargs to the new instance of ``Rule``, following the initial ``self.rule`` value which is always provided as the first, required positional argument. N) rrrzrrlrrrr) rr`rrzrrlrrrr)rWrr*r*r+rs  zRule.get_empty_kwargsrrccs |VdSrTr*rr*r*r+rszRule.get_rulescCs|j|jdddS)zqRebinds and refreshes the URL. Call this if you modified the rule in place. :internal: T)rebindN)bindrrsr*r*r+refreshsz Rule.refresh)rrr"cCsl|jdk r$|s$td|d|j||_|jdkr<|j|_|jdkrN|j|_|jdkr`|j|_|dS)zBind the url to a map and create a regular expression based on the information from the rule itself and the defaults from the map. :internal: Nz url rule z already bound to map )r RuntimeErrorrrrdefault_subdomaincompile)rWrrr*r*r+r s   z Rule.bind BaseConverter) variable_nameconverter_namer5r6r"cCs6||jjkrtd|d|jj||jf||S)zWLooks up the converter for the given parameter. .. versionadded:: 0.9 zthe converter z does not exist)r converters LookupError)rWrrr5r6r*r*r+ get_converters zRule.get_converter) query_varsr"cCst||jj|jj|jjdS)N)charsetsortr~)rrrsort_parameterssort_key)rWrr*r*r+_encode_query_vars-s zRule._encode_query_varscs>jdk stdjjr&jp"d}n jp.d}g_i_g_g_gt ddfdd }|| dj d|j rj n j d j sj d d d_d d_jrdSj rjsjrd nd}d|d}nd}dd|d}t|_dS)z.Compiles the regular expression and stores it.Nzrule not boundrr9c sFd}t|D]2\}}}|dkrtd|D]}|d}|dr~jrbdjdq,|jd|fq,jd|ft||r,j |t | fq,n||rt |\}}nd}i} ||||} d|d | j d | j|<jd |fj| jjt||d }q dS) Nrz/+|[^/]+rz/+?FrFr*z(?PrTr)rKrer1r2rrr3rescape_static_weightsr@r8rregex _converters_argument_weightsweightryrEr() r:indexr<ryr;rBpartZc_argsZc_kwargsZconvobjZ regex_partsrWr*r+ _build_regexDs6     z"Rule.compile.._build_regexz\|)F|rrFT*rz(?/r^$)rAssertionError host_matchingrrrrrrr(r3rr:r_compile_builder__get___build_build_unknownrrrrrr_regex)rWZ domain_rulerZrepstailrr*rr+r5s>       z Rule.compile)rrnr"c Csp|jsld}|j|}|dk rl|}|jrj|jsj|dsj|dks\|jdks\||jkrj|d7}d}n |jsv|d=i}|D]B\}}z|j | |}Wnt k rYdSX||t |<q|j r||j |jr0d||d} |dr| ds| d7} | d|dkr0| }d}|rN|ddd}t||jrh|jjrht||SdS)auCheck if the rule matches a given path. Path is a string in the form ``"subdomain|/path"`` and is assembled by the map. If the map is doing host matching the subdomain part will be the host instead. If the rule matches a dict with the converted values is returned, otherwise the return value is `None`. :internal: FNZ __suffix__rTrr)rrsearchrDrrpoprzrr to_pythonrr(rupdaterrbuildrcountsplitrbrrredirect_defaultsrf) rWrrnrequire_redirectrHgroupsresultr/r!new_pathr*r*r+rB~sX     z Rule.match)r\r/r"cCsi}i}t|||||SrT)exec)r\r/ZglobsZlocsr*r*r+_get_func_codes zRule._get_func_codeT)append_unknownr"c sZ|jpig}g}|}|jD]\}}|dkr:||kr:|}q|rj|krj|j||}|d|fq|s|dtt||jjddfq|d|fqt t j dddt j t jtt ft j t jd fd d }||}||} |sg} ntg} | tt j t jt jd d d} | t t | || | gt fdd||D} ddD} td}d|jd|_|jjt dd| | D]}|jjt |dqt dd|j_| D]}|jjt dq| |_t d}|g|_t |D]*}d|j kr*d|_!d|j krd|_"qt#|dd}|$||jS)NrF/:|+safeT)elemr"cSs,ttj|d}tt|tg|_|S)N)r)r_CALL_CONVERTER_CODE_FMTformatrrr(Loadr5)rretr*r*r+_convertsz'Rule._compile_builder.._convert)opsr"csfdd|D}|p tdg}|dg}|ddD]F}t|tjrtt|dtjrtt|dj|j|d<q8||q8|S)Ncs(g|] \}}|r|n tj|dqS))s)rStrr is_dynamicrrr*r+ sz9Rule._compile_builder.._parts..rrrr#)rrrrr3)rpartsrprr*r+_partss   z%Rule._compile_builder.._parts)rr"cSst|dkr|dSt|S)Nrr)r@rZ JoinedStr)rr*r*r+_joins z$Rule._compile_builder.._joincs g|]\}}|r|kr|qSr*r*r)rr*r+rsz)Rule._compile_builder..cSsg|] }t|qSr*r()rkr*r*r+r sz def _(): passz z.selfz.kwargsrlinenor col_offsetrzr)%rrrto_urlr3rr rrr(rstmtr^ListTuplerwAST_IF_KWARGS_URL_ENCODE_ASTextend_URL_ENCODE_AST_NAMESZReturnrrr:r/r5argkwargrrrr _attributesr!r"rr )rWr Zdom_opsZurl_opsZoplrrIrZ dom_partsZ url_partsrrZpargsZkargsZfunc_astr+_modulerr\r*)rrr+rsd  ,         zRule._compile_builder)rmr r"cCs@z$|r|jf|WS|jf|WSWntk r:YdSXdS)zAssembles the relative url for that rule and the subdomain. If building doesn't work for some reasons `None` is returned. :internal: N)rrr)rWrmr r*r*r+r(s z Rule.buildr9cCs2t|j o.|jo.|j|jko.||ko.|j|jkS)zNCheck if this rule has defaults for a given rule. :internal: )rwrrrlry)rWr:r*r*r+provides_defaults_for8s  zRule.provides_defaults_for)rmrnr"cCs|dk r |jdk r ||jkr dS|jp(d}|jD]}||kr0||kr0dSq0|r||D]"\}}||krX|||krXdSqXdS)z\Check if the dict of values has enough data for url generation. :internal: NFr*T)rzrryr)rWrmrnrr~r!r*r*r+ suitable_forEs   zRule.suitable_forcCs(t|jt|j |jt|j |jfS)aThe match compare key for sorting. Current implementation: 1. rules without any arguments come first for performance reasons only as we expect them to match faster and some common ones usually don't have any arguments (index pages etc.) 2. rules with more static parts come first so the second argument is the negative length of the number of the static weights. 3. we order by static weights, which is a combination of index and length 4. The more complex rules come first so the next argument is the negative length of the number of argument weights. 5. lastly we order by the actual argument weights. :internal: )rwryr@rrrsr*r*r+match_compare_keyfs   zRule.match_compare_keycCs(|jr dndt|j t|jp d fS)z?The build compare key for sorting. :internal: rrr*)rr@ryrrsr*r*r+build_compare_keyszRule.build_compare_key)otherr"cCst|t|o|j|jkSrT)rrr)rWr4r*r*r+__eq__sz Rule.__eq__cCs|jSrTr{rsr*r*r+rsz Rule.__str__cCs|jdkrdt|jdSg}|jD]*\}}|rF|d|dq&||q&d|d}|jdk rdd|jdnd}dt|jd ||d |jdS) Nr?z (unbound)>r>rrrz, r z -> ) rrrNrr3rlstriprzrl)rWrrrIrzr*r*r+__repr__s  "z Rule.__repr__) NNNFNNNNFNF)F)N)T)T)N))rNrOrPrQr(r^r_rhrirrwUnionCallablerVrrrrrrr&rrrMutableMappingrB staticmethodrr rrr0r1r%r2r3objectr5__hash__rr8r*r*r*r+rp*s~ 7  J C( a  #( rpc@sTeZdZdZdZdZdejejddddZe ejd d d Z eje d d d Z dS)rzBase class for all converters.z[^/]+drN)rr5r6r"cOs ||_dSrT)r)rWrr5r6r*r*r+rVszBaseConverter.__init__r cCs|SrTr*rWr!r*r*r+rszBaseConverter.to_pythoncCs,t|ttfrt|Stt||jjSrT)rbytes bytearrayrr(encoderrr@r*r*r+r#szBaseConverter.to_url) rNrOrPrQrrr^rirVr(rr#r*r*r*r+rs rcs<eZdZdZddeejeejeddfdd ZZS) UnicodeConverteraThis converter is the default converter and accepts any string but only one path segment. Thus the string can not include a slash. This is the default validator. Example:: Rule('/pages/'), Rule('/') :param map: the :class:`Map`. :param minlength: the minimum length of the string. Must be greater or equal 1. :param maxlength: the maximum length of the string. :param length: the exact length of the string. rNr)r minlength maxlengthlengthr"csft||dk r&dt|d}n0|dkr4d}n tt|}dt|d|d}d||_dS)N{}rr.z[^/])rUrVr%r(r)rWrrErFrGZ length_regexZmaxlength_valuerXr*r+rVs  zUnicodeConverter.__init__)rNN) rNrOrPrQr%r^r_rVrar*r*rXr+rDsrDcs*eZdZdZdeddfdd ZZS) AnyConvertera3Matches one of the items provided. Items can either be Python identifiers or strings:: Rule('/') :param map: the :class:`Map`. :param items: this function accepts the possible items as positional arguments. rN)rrr"cs.t|dddd|Dd|_dS)Nz(?:rcSsg|]}t|qSr*)rrrr*r*r+rsz)AnyConverter.__init__..r)rUrVrr)rWrrrXr*r+rVs zAnyConverter.__init__)rNrOrPrQr(rVrar*r*rXr+rJs rJc@seZdZdZdZdZdS) PathConverterzLike the default :class:`UnicodeConverter`, but it also matches slashes. This is useful for wikis and similar applications:: Rule('/') Rule('//edit') :param map: the :class:`Map`. z[^/].*?N)rNrOrPrQrrr*r*r*r+rKs rKcseZdZUdZdZeZeje d<ddeej eej ee ddfd d Z e ejd d d Zeje d ddZee dddZZS)NumberConverterzKBaseclass for `IntegerConverter` and `FloatConverter`. :internal: 2 num_convertrNFr)r fixed_digitsminrsignedr"cs4|r |j|_t|||_||_||_||_dSrT) signed_regexrrUrVrPrQrrR)rWrrPrQrrRrXr*r+rVs zNumberConverter.__init__r cCsV|jrt||jkrt||}|jdk r8||jksL|jdk rR||jkrRt|SrT)rPr@rrOrQrr@r*r*r+r s zNumberConverter.to_pythoncCs$t||}|jr ||j}|SrT)r(rOrPzfillr@r*r*r+r#s zNumberConverter.to_urlrqcCs d|jS)Nz-?)rrsr*r*r+rSszNumberConverter.signed_regex)rNNF)rNrOrPrQrr%rOr^r:__annotations__r_rwrVr(rirr#propertyrSrar*r*rXr+rMs&  rMc@seZdZdZdZdS)IntegerConverteraThis converter only accepts integer values:: Rule("/page/") By default it only accepts unsigned, positive values. The ``signed`` parameter will enable signed, negative values. :: Rule("/page/") :param map: The :class:`Map`. :param fixed_digits: The number of fixed digits in the URL. If you set this to ``4`` for example, the rule will only match if the URL looks like ``/0001/``. The default is variable length. :param min: The minimal value. :param max: The maximal value. :param signed: Allow signed (negative) values. .. versionadded:: 0.15 The ``signed`` parameter. z\d+N)rNrOrPrQrr*r*r*r+rW"srWcsDeZdZdZdZeZd dejeejee ddfdd Z Z S) FloatConverteraThis converter only accepts floating point values:: Rule("/probability/") By default it only accepts unsigned, positive values. The ``signed`` parameter will enable signed, negative values. :: Rule("/offset/") :param map: The :class:`Map`. :param min: The minimal value. :param max: The maximal value. :param signed: Allow signed (negative) values. .. versionadded:: 0.15 The ``signed`` parameter. z\d+\.\d+NFr)rrQrrRr"cstj||||ddS)N)rQrrR)rUrV)rWrrQrrRrXr*r+rVQszFloatConverter.__init__)NNF) rNrOrPrQrr&rOr^r_rwrVrar*r*rXr+rX;srXc@s8eZdZdZdZeejdddZejedddZ dS) UUIDConverterzThis converter only accepts UUID strings:: Rule('/object/') .. versionadded:: 0.10 :param map: the :class:`Map`. zK[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}r cCs t|SrT)uuidUUIDr@r*r*r+rjszUUIDConverter.to_pythoncCst|SrTrr@r*r*r+r#mszUUIDConverter.to_urlN) rNrOrPrQrr(rZr[rr#r*r*r*r+rY[s  rY)r=ranyrr%r&rZDEFAULT_CONVERTERSc@sDeZdZdZeeZeZd#e j e j e e e eeee j e je e jefee j e je jge jfe edd d d Ze e ed d d Zd$e j e e jedddZe ddddZd%e e j e e j e e e e j e e j e je je e jfe fddddZd&de j e e j e ddddZdddd Ze dd!d"ZdS)'raThe map class stores all the URL rules and some configuration parameters. Some of the configuration values are only stored on the `Map` instance since those affect all rules, others are just defaults and can be overridden for each rule. Note that you have to specify all arguments besides the `rules` as keyword arguments! :param rules: sequence of url rules for this map. :param default_subdomain: The default subdomain for rules without a subdomain defined. :param charset: charset of the url. defaults to ``"utf-8"`` :param strict_slashes: If a rule ends with a slash but the matched URL does not, redirect to the URL with a trailing slash. :param merge_slashes: Merge consecutive slashes when matching or building URLs. Matches will redirect to the normalized URL. Slashes in variable parts are not merged. :param redirect_defaults: This will redirect to the default rule if it wasn't visited that way. This helps creating unique URLs. :param converters: A dict of converters that adds additional converters to the list of converters. If you redefine one converter this will override the original one. :param sort_parameters: If set to `True` the url parameters are sorted. See `url_encode` for more details. :param sort_key: The sort key function for `url_encode`. :param encoding_errors: the error method to use for decoding :param host_matching: if set to `True` it enables the host matching feature and disables the subdomain one. If enabled the `host` parameter to rules is used instead of the `subdomain` one. .. versionchanged:: 1.0 If ``url_scheme`` is ``ws`` or ``wss``, only WebSocket rules will match. .. versionchanged:: 1.0 Added ``merge_slashes``. .. versionchanged:: 0.7 Added ``encoding_errors`` and ``host_matching``. .. versionchanged:: 0.5 Added ``sort_parameters`` and ``sort_key``. Nrutf-8TFreplace) rrrrrrrrrencoding_errorsrr"c Csg|_i|_d|_||_||_||_| |_||_||_ ||_ | |_ |j |_|rb|j|||_| |_|ptdD]} || qvdS)NTr*)r_rules_by_endpoint_remap lock_class _remap_lockrrr`rrrrdefault_converterscopyrrrrrE) rWrrrrrrrrrr`rrr*r*r+rVs$    z Map.__init__)rlryr"cGs6|t|}|j|D]}||jrdSqdS)aQIterate over all rules and check if the endpoint expects the arguments provided. This is for example useful if you have some URLs that expect a language code and others that do not and you want to wrap the builder a bit so that the current language code is automatically added if not provided but endpoints expect it. :param endpoint: the endpoint to check. :param arguments: this function accepts one or more arguments as positional arguments. Each one of them is checked. TF)rrCrarxry)rWrlryr:r*r*r+is_endpoint_expectings  zMap.is_endpoint_expecting)rlr"cCs(||dk rt|j|St|jS)zIterate over all rules or the rules of an endpoint. :param endpoint: if provided only the rules for that endpoint are returned. :return: an iterator N)riterrar)rWrlr*r*r+ iter_rulesszMap.iter_rules)rr"cCsF||D]0}|||j||j|jg|q d|_dS)zAdd a new rule or factory to the map and bind it. Requires that the rule is not bound to another map. :param rulefactory: a :class:`Rule` or :class:`RuleFactory` TN)rrrr3ra setdefaultrlrb)rWrr:r*r*r+rEs   zMap.addhttprrk) server_name script_namer url_schemedefault_methodrc query_argsr"c Cs|}|jr |dk r.tdn|dkr.|j}|dkr:d}|dkrFd}z t|}Wntk rltYnXt||||||||S)aReturn a new :class:`MapAdapter` with the details specified to the call. Note that `script_name` will default to ``'/'`` if not further specified or `None`. The `server_name` at least is a requirement because the HTTP RFC requires absolute URLs for redirects and so all redirect exceptions raised by Werkzeug will contain the full canonical URL. If no path_info is passed to :meth:`match` it will use the default path info passed to bind. While this doesn't really make sense for manual bind calls, it's useful if you bind a map to a WSGI environment which already contains the path info. `subdomain` will default to the `default_subdomain` for this map if no defined. If there is no `default_subdomain` you cannot use the subdomain feature. .. versionchanged:: 1.0 If ``url_scheme`` is ``ws`` or ``wss``, only WebSocket rules will match. .. versionchanged:: 0.15 ``path_info`` defaults to ``'/'`` if ``None``. .. versionchanged:: 0.8 ``query_args`` can be a string. .. versionchanged:: 0.7 Added ``query_args``. Nz2host matching enabled and a subdomain was providedr)lowerrrrr UnicodeErrorrrk)rWrlrmrrnrorcrpr*r*r+rs0'   zMap.bindr)rZrlrr"c sttt}d}dddkrTdddkrT|dkrPdnd }|d krb|}nF|}|d kr|d r|d d }n|dkr|dr|d d}|d kr"js"|d}|d}t| }||d |kr tj d|d|ddd}nd t d |d |}t t jt dfdd } | d} | d} | d} tj|| ||d| | dS)aLike :meth:`bind` but you can pass it an WSGI environment and it will fetch the information from that dictionary. Note that because of limitations in the protocol there is no way to get the current subdomain and real `server_name` from the environment. If you don't provide it, Werkzeug will use `SERVER_NAME` and `SERVER_PORT` (or `HTTP_HOST` if provided) as used `server_name` with disabled subdomain feature. If `subdomain` is `None` but an environment and a server name is provided it will calculate the current subdomain automatically. Example: `server_name` is ``'example.com'`` and the `SERVER_NAME` in the wsgi `environ` is ``'staging.dev.example.com'`` the calculated subdomain will be ``'staging.dev'``. If the object passed as environ has an environ attribute, the value of this attribute is used instead. This allows you to pass request objects. Additionally `PATH_INFO` added as a default of the :class:`MapAdapter` so that you don't have to pass the path info to the match method. .. versionchanged:: 1.0.0 If the passed server name specifies port 443, it will match if the incoming scheme is ``https`` without a port. .. versionchanged:: 1.0.0 A warning is shown when the passed server name does not match the incoming WSGI server name. .. versionchanged:: 0.8 This will no longer raise a ValueError when an unexpected server name was passed. .. versionchanged:: 0.5 previously this method accepted a bogus `calculate_subdomain` parameter that did not have any effect. It was removed because of that. :param environ: a WSGI environment. :param server_name: an optional server name hint (see above). :param subdomain: optionally the current subdomain (see above). zwsgi.url_schemeZHTTP_CONNECTIONrupgradeZ HTTP_UPGRADErhttpswsswsN>rkrvz:80>rtruz:443rzCurrent server name z& doesn't match configured server name ) stacklevelz )r/r"cs"|}|dk rt|jSdSrT)getr r)r/valrZrWr*r+_get_wsgi_strings  z-Map.bind_to_environ.._get_wsgi_stringZ SCRIPT_NAMEZ PATH_INFO QUERY_STRINGREQUEST_METHOD)rp)rrrqr{rrrr@warningswarnrfilterr(r^r_rr) rWrZrlrZwsgi_server_nameschemeZcur_server_nameZreal_server_nameoffsetr~rmrcrpr*r}r+bind_to_environCsP/     zMap.bind_to_environrqc Csl|js dS|jR|js&W5QRdS|jjddd|jD]}|jdddqBd|_W5QRXdS)zzCalled before matching and building to keep the compiled rules in the correct order after things changed. NcSs|SrT)r2rr*r*r+zMap.update..r}cSs|SrT)r3rr*r*r+rrF)rbrdrrrarmrr*r*r+rsz Map.updatecCs&|}t|jdtt|dS)N(r)rirrNrrrr*r*r+r8sz Map.__repr__) Nrr^TTTNFNr_F)N)NNrkrNN)NN)rNrOrPrQr r]rerrcr^r_rrr(rwrhTyperr:rirVrgrrprirEr9rrrr8r*r*r*r+r}sr- %  C lrc @s\eZdZdZd.eeeejeeeeejejej eej fefdddZ d/ej eej eej fgdfejeejee ddd d Zejd0ejeejed ejejej eej fefeje ejeej eej ffd d dZejd1ejeejedejejej eej fefeje ejeej eej ffd ddZd2ejeejee ejejej eej fefeje ejejeefej eej ffd ddZd3ejeejee dddZd4ejeejedddZejeedddZeeejeej fejej eej fefejedddZejej eej fefedd d!Zd5eejejej eej fefejeed"d#d$Zeeej eej feejej eej fefed%d&d'Zeej eej fejee ejejeee fd(d)d*Zd6eejej eej fejee e ejeed+d,d-ZdS)7rkzReturned by :meth:`Map.bind` or :meth:`Map.bind_to_environ` and does the URL matching and building based on runtime information. N)rrlrmrrnrcrorpc Csn||_t||_t|}|ds*|d7}||_t||_t||_t||_t||_||_ |jdk|_ dS)Nr>rurv) rr rlrrmrrnrcrorpr) rWrrlrmrrnrcrorpr*r*r+rVs       zMapAdapter.__init__Fr) view_funcrcrncatch_http_exceptionsr"c CszNz|||\}}Wn,tk rB}z|WYWSd}~XYnX|||WStk r}z|rp|WYSW5d}~XYnXdS)a3Does the complete dispatching process. `view_func` is called with the endpoint and a dict with the values for the view. It should look up the view function, call it, and return a response object or WSGI application. http exceptions are not caught by default so that applications can display nicer error messages by just catching them by hand. If you want to stick with the default error messages you can pass it ``catch_http_exceptions=True`` and it will catch the http exceptions. Here a small example for the dispatch usage:: from werkzeug.wrappers import Request, Response from werkzeug.wsgi import responder from werkzeug.routing import Map, Rule def on_index(request): return Response('Hello from the index') url_map = Map([Rule('/', endpoint='index')]) views = {'index': on_index} @responder def application(environ, start_response): request = Request(environ) urls = url_map.bind_to_environ(environ) return urls.dispatch(lambda e, v: views[e](request, **v), catch_http_exceptions=True) Keep in mind that this method might return exception objects, too, so use :class:`Response.force_type` to get a response object. :param view_func: a function that is called with the endpoint as first argument and the value dict as second. Has to dispatch to the actual view function with this information. (see above) :param path_info: the path info to use for matching. Overrides the path info specified on binding. :param method: the HTTP method used for matching. Overrides the method specified on binding. :param catch_http_exceptions: set to `True` to catch any of the werkzeug :class:`HTTPException`\s. NrBrRr)rWrrcrnrrlr5er*r*r+dispatchs1  zMapAdapter.dispatchzte.Literal[False])rcrn return_rulerprr"cCsdSrTr*rWrcrnrrprr*r*r+rBs zMapAdapter.matchTzte.Literal[True]cCsdSrTr*rr*r*r+rB)s c s|j|dkr|j}nt||jj}|dkr:|jp8i}|pB|j}|dkrV|j}d}|jj rh|j n|j }|rd| dnd}|d|} t } d} |jjD]z| |Wn~tk r} z$t|t| j|jjdd|W5d} ~ XYn>tk r:} zt|| j| j||W5d} ~ XYnXdkrHqjdk rn|jkrn| jqj|krd} q|jjr|||} | dk rt| jdk rHtjtrtjttd fd d }t !|j} nj|f} |j r|j d |j }n|j }tt"|j#p0d d||j$| |rlt|t||jjdd||r~fSjfSq| rt%t&| d| rt't(dS)aThe usage is simple: you just pass the match method the current path info as well as the method (which defaults to `GET`). The following things can then happen: - you receive a `NotFound` exception that indicates that no URL is matching. A `NotFound` exception is also a WSGI application you can call to get a default page not found page (happens to be the same object as `werkzeug.exceptions.NotFound`) - you receive a `MethodNotAllowed` exception that indicates that there is a match for this URL but not for the current request method. This is useful for RESTful applications. - you receive a `RequestRedirect` exception with a `new_url` attribute. This exception is used to notify you about a request Werkzeug requests from your WSGI application. This is for example the case if you request ``/foo`` although the correct URL is ``/foo/`` You can use the `RequestRedirect` instance as response-like object similar to all other subclasses of `HTTPException`. - you receive a ``WebsocketMismatch`` exception if the only match is a WebSocket rule but the bind is an HTTP request, or if the match is an HTTP rule but the bind is a WebSocket request. - you get a tuple in the form ``(endpoint, arguments)`` if there is a match (unless `return_rule` is True, in which case you get a tuple in the form ``(rule, arguments)``) If the path info is not passed to the match method the default path info of the map is used (defaults to the root URL if not defined explicitly). All of the exceptions raised are subclasses of `HTTPException` so they can be used as WSGI responses. They will all render generic error or redirect pages. Here is a small example for matching: >>> m = Map([ ... Rule('/', endpoint='index'), ... Rule('/downloads/', endpoint='downloads/index'), ... Rule('/downloads/', endpoint='downloads/show') ... ]) >>> urls = m.bind("example.com", "/") >>> urls.match("/", "GET") ('index', {}) >>> urls.match("/downloads/42") ('downloads/show', {'id': 42}) And here is what happens on redirect and missing URLs: >>> urls.match("/downloads") Traceback (most recent call last): ... RequestRedirect: http://example.com/downloads/ >>> urls.match("/missing") Traceback (most recent call last): ... NotFound: 404 Not Found :param path_info: the path info to use for matching. Overrides the path info specified on binding. :param method: the HTTP method used for matching. Overrides the method specified on binding. :param return_rule: return the rule that matched instead of just the endpoint (defaults to `False`). :param query_args: optional query arguments that are used for automatic redirects as string or dictionary. It's currently not possible to use the query arguments for URL matching. :param websocket: Match WebSocket instead of HTTP requests. A websocket request has a ``ws`` or ``wss`` :attr:`url_scheme`. This overrides that detection. .. versionadded:: 1.0 Added ``websocket``. .. versionchanged:: 0.8 ``query_args`` can be a string. .. versionadded:: 0.7 Added ``query_args``. .. versionadded:: 0.6 Added ``return_rule``. NFrrrr r T)rBr"cs$|d}j|d|S)Nr)r2rr#)rBr!r:rvr*r+ _handle_matchsz'MapAdapter.match.._handle_matchrrk://) valid_methods))rrrcr rrprorrrrlrr7rCrrBrbrRmake_redirect_urlrrfmake_alias_redirect_urlrlrgrzrget_default_redirectrrr(r^Match_simple_rule_resubrrnrmrrrr)rWrcrnrrprr domain_partZ path_partrZhave_match_forZwebsocket_mismatchrZ redirect_urlrnetlocr*rr+rB4s_         )rcrnr"cCs>z|||Wn(tk r$Yntk r8YdSXdS)aTest if a rule would match. Works like `match` but returns `True` if the URL matches, or `False` if it does not exist. :param path_info: the path info to use for matching. Overrides the path info specified on binding. :param method: the HTTP method used for matching. Overrides the method specified on binding. FTr)rWrcrnr*r*r+tests zMapAdapter.testrdc CsVz|j|ddWn>tk r>}z|jWYSd}~XYntk rPYnXgS)z^Returns the valid methods that match for a given path. .. versionadded:: 0.7 z--)rnN)rBrrr)rWrcrr*r*r+allowed_methodsszMapAdapter.allowed_methods)rr"cCs\|jjr |dkr|jSt|dS|}|dkr4|j}n t|d}|rR|d|jS|jSdS)zFigures out the full host name for the given domain part. The domain part is a subdomain in case host matching is disabled or a full host name. Nasciir)rrrlr r)rWrrr*r*r+rs  zMapAdapter.get_host)r:rnrmrpr"cCst|jjs t|jj|jD]T}||kr*qp||r|||r||j| |\}}|j |||dSqdS)zA helper that returns the URL to redirect to if it finds one. This is used for default redirecting only. :internal: )rN) rrrrarlr0r1rrrr)rWr:rnrmrprrrr*r*r+r&s  zMapAdapter.get_default_redirect)rpr"cCst|tst||jjS|SrT)rr(rrr)rWrpr*r*r+encode_query_args?s zMapAdapter.encode_query_args)rcrprr"cCs`|rd||}nd}|jp"d}||}t|jd|d}|d|d||S)z4Creates a redirect URL. :internal: rrrkrr)rrnr posixpathrrmstripr7)rWrcrprsuffixrrrr*r*r+rDs   zMapAdapter.make_redirect_url)rrlrmrnrpr"cCs@|j|||ddd}|r,|d||7}||ks>> m = Map([ ... Rule('/', endpoint='index'), ... Rule('/downloads/', endpoint='downloads/index'), ... Rule('/downloads/', endpoint='downloads/show') ... ]) >>> urls = m.bind("example.com", "/") >>> urls.build("index", {}) '/' >>> urls.build("downloads/show", {'id': 42}) '/downloads/42' >>> urls.build("downloads/show", {'id': 42}, force_external=True) 'http://example.com/downloads/42' Because URLs cannot contain non ASCII data you will always get bytes back. Non ASCII characters are urlencoded with the charset defined on the map instance. Additional values are converted to strings and appended to the URL as URL querystring parameters: >>> urls.build("index", {'q': 'My Searchstring'}) '/?q=My+Searchstring' When processing those additional values, lists are furthermore interpreted as multiple values (as per :py:class:`werkzeug.datastructures.MultiDict`): >>> urls.build("index", {'q': ['a', 'b', 'c']}) '/?q=a&q=b&q=c' Passing a ``MultiDict`` will also add multiple values: >>> urls.build("index", MultiDict((('p', 'z'), ('q', 'a'), ('q', 'b')))) '/?p=z&q=a&q=b' If a rule does not exist when building a `BuildError` exception is raised. The build method accepts an argument called `method` which allows you to specify the method you want to have an URL built for if you have different methods for the same endpoint specified. :param endpoint: the endpoint of the URL to build. :param values: the values for the URL to build. Unhandled values are appended to the URL as query parameters. :param method: the HTTP method for the rule if there are different URLs for different methods on the same endpoint. :param force_external: enforce full canonical external URLs. If the URL scheme is not provided, this will generate a protocol-relative URL. :param append_unknown: unknown parameters are appended to the generated URL as query string argument. Disable this if you want the builder to ignore those. :param url_scheme: Scheme to use in place of the bound :attr:`url_scheme`. .. versionchanged:: 2.0 Added the ``url_scheme`` parameter. .. versionadded:: 0.6 Added the ``append_unknown`` parameter. NcSsg|]}|dk r|qSrTr*)rvr*r*r+rsz$MapAdapter.build..rr>rtruTrurvrtrkr:rz//r#)rrrr r`rrr4r@rrjrrnrrlrrmrr7)rWrlrmrnrr rnZ temp_valuesZ always_listr~r!rrrrrsecurerr*r*r+rsRP       zMapAdapter.build)N)NNF)NNFNN)NNTNN)NNFNN)NN)N)NN)NNFTN)rNrOrPrQrr(r^r_r9rhrirVr:rwrtypingoverloadr&rBrprrrrr;rrrrrrr*r*r*r+rks   <  " @   &   ,rk)jrQrrvrrrr^rZrpprintrrr threadingrtypesr _internalrrr r r Zdatastructuresr r exceptionsrrrrrurlsrrrrutilsrrZwsgir TYPE_CHECKINGZtyping_extensionsteZ_typeshed.wsgirrZwrappers.responserrVERBOSErArr0r$r(r9rwr%r&r,r&rrir8rr_rK ExceptionrLrRrbrfrrjrr'rrrrrrrr$rrZ_IF_KWARGS_URL_ENCODE_CODEr(r*rprrDrJrKrMrWrXrYr]rhrrUrrkr*r*r*r+sk                               (.  F % y%.  I