Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
routing.cpython-313.pyc396 linesDownload Raw Back to __pycache__
1�

2��je���SrSSKrSSKJr SSKJr SSKJr SSKJ	r	J3r4Jr SSKJ
r
 SSKJrJrJrJr SS	KJrJrJrJrJrJrJrJrJrJr "S5S\R<5r"SS
\5r "SS\RB5r""SS\RB5r#\\S\\\\\$S4\4\\\$S4\\\$\44\\\$S4\\\$\4\$44r%"SS\5r&"SS\ \&5r'"SS5r("SS5r)"SS\)5r*"SS\)5r+"SS\)5r,"S S!\)5r-"S"S#\(5r.\S$\$S%\/4S&j5r0\S)S'j5r0S$\\$S%\\/4S(jr0g)*apFlexible routing implementation.6 7Tornado routes HTTP requests to appropriate handlers using `Router`8class implementations. The `tornado.web.Application` class is a9`Router` implementation and may be used directly, or the classes in10this module may be used for additional flexibility. The `RuleRouter`11class can match on more criteria than `.Application`, or the `Router`12interface can be subclassed for maximum customization.13 14`Router` interface extends `~.httputil.HTTPServerConnectionDelegate`15to provide additional routing capabilities. This also means that any16`Router` implementation can be used directly as a ``request_callback``17for `~.httpserver.HTTPServer` constructor.18 19`Router` subclass must implement a ``find_handler`` method to provide20a suitable `~.httputil.HTTPMessageDelegate` instance to handle the21request:22 23.. code-block:: python24 25    class CustomRouter(Router):26        def find_handler(self, request, **kwargs):27            # some routing logic providing a suitable HTTPMessageDelegate instance28            return MessageDelegate(request.connection)29 30    class MessageDelegate(HTTPMessageDelegate):31        def __init__(self, connection):32            self.connection = connection33 34        def finish(self):35            self.connection.write_headers(36                ResponseStartLine("HTTP/1.1", 200, "OK"),37                HTTPHeaders({"Content-Length": "2"}),38                b"OK")39            self.connection.finish()40 41    router = CustomRouter()42    server = HTTPServer(router)43 44The main responsibility of `Router` implementation is to provide a45mapping from a request to `~.httputil.HTTPMessageDelegate` instance46that will handle this request. In the example above we can see that47routing is possible even without instantiating an `~.web.Application`.48 49For routing to `~.web.RequestHandler` implementations we need an50`~.web.Application` instance. `~.web.Application.get_handler_delegate`51provides a convenient way to create `~.httputil.HTTPMessageDelegate`52for a given request and `~.web.RequestHandler`.53 54Here is a simple example of how we can we route to55`~.web.RequestHandler` subclasses by HTTP method:56 57.. code-block:: python58 59    resources = {}60 61    class GetResource(RequestHandler):62        def get(self, path):63            if path not in resources:64                raise HTTPError(404)65 66            self.finish(resources[path])67 68    class PostResource(RequestHandler):69        def post(self, path):70            resources[path] = self.request.body71 72    class HTTPMethodRouter(Router):73        def __init__(self, app):74            self.app = app75 76        def find_handler(self, request, **kwargs):77            handler = GetResource if request.method == "GET" else PostResource78            return self.app.get_handler_delegate(request, handler, path_args=[request.path])79 80    router = HTTPMethodRouter(Application())81    server = HTTPServer(router)82 83`ReversibleRouter` interface adds the ability to distinguish between84the routes and reverse them to the original urls using route's name85and additional arguments. `~.web.Application` is itself an86implementation of `ReversibleRouter` class.87 88`RuleRouter` and `ReversibleRuleRouter` are implementations of89`Router` and `ReversibleRouter` interfaces and can be used for90creating rule-based routing configurations.91 92Rules are instances of `Rule` class. They contain a `Matcher`, which93provides the logic for determining whether the rule is a match for a94particular request and a target, which can be one of the following.95 961) An instance of `~.httputil.HTTPServerConnectionDelegate`:97 98.. code-block:: python99 100    router = RuleRouter([101        Rule(PathMatches("/handler"), ConnectionDelegate()),102        # ... more rules103    ])104 105    class ConnectionDelegate(HTTPServerConnectionDelegate):106        def start_request(self, server_conn, request_conn):107            return MessageDelegate(request_conn)108 1092) A callable accepting a single argument of `~.httputil.HTTPServerRequest` type:110 111.. code-block:: python112 113    router = RuleRouter([114        Rule(PathMatches("/callable"), request_callable)115    ])116 117    def request_callable(request):118        request.write(b"HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\nOK")119        request.finish()120 1213) Another `Router` instance:122 123.. code-block:: python124 125    router = RuleRouter([126        Rule(PathMatches("/router.*"), CustomRouter())127    ])128 129Of course a nested `RuleRouter` or a `~.web.Application` is allowed:130 131.. code-block:: python132 133    router = RuleRouter([134        Rule(HostMatches("example.com"), RuleRouter([135            Rule(PathMatches("/app1/.*"), Application([(r"/app1/handler", Handler)])),136        ]))137    ])138 139    server = HTTPServer(router)140 141In the example below `RuleRouter` is used to route between applications:142 143.. code-block:: python144 145    app1 = Application([146        (r"/app1/handler", Handler1),147        # other handlers ...148    ])149 150    app2 = Application([151        (r"/app2/handler", Handler2),152        # other handlers ...153    ])154 155    router = RuleRouter([156        Rule(PathMatches("/app1.*"), app1),157        Rule(PathMatches("/app2.*"), app2)158    ])159 160    server = HTTPServer(router)161 162For more information on application-level routing see docs for `~.web.Application`.163 164.. versionadded:: 4.5165 166�N)�partial)�httputil)�_CallableAdapter)�167url_escape�url_unescape�utf8)�app_log)�basestring_type�
import_object�re_unescape�unicode_type)168�Any�Union�Optional�	Awaitable�List�Dict�Pattern�Tuple�overload�Sequencec��\rSrSrSrS\RS\S\\R4Sjr169S\S\RS\R4S	jr
S170rg)�Router��zAbstract router interface.�request�kwargs�returnc��[5e)a�Must be implemented to return an appropriate instance of `~.httputil.HTTPMessageDelegate`171that can serve the request.172Routing implementations may pass additional kwargs to extend the routing logic.173 174:arg httputil.HTTPServerRequest request: current HTTP request.175:arg kwargs: additional keyword arguments passed by routing implementation.176:returns: an instance of `~.httputil.HTTPMessageDelegate` that will be used to177    process the request.178��NotImplementedError)�selfrrs   �UD:\code\apps\devtools\python\user_packages\Python313\site-packages\tornado/routing.py�find_handler�Router.find_handler�s
��"�#�#��server_conn�request_connc��[XU5$�N)�_RoutingDelegate)r!r&r's   r"�
start_request�Router.start_request�s�� ��<�@�@r%�N)�__name__�179__module__�__qualname__�__firstlineno__�__doc__r�HTTPServerRequestrr�HTTPMessageDelegater#�object�HTTPConnectionr+�__static_attributes__r-r%r"rr�s`��$�$��1�1�$�=@�$�	�(�.�.�	/�$�A�!�A�19�1H�1H�A�	�	%�	%�Ar%rc�4�\rSrSrSrS\S\S\\4SjrSr	g)	�ReversibleRouter��zpAbstract router interface for routers that can handle named routes180and support reversing them to original urls.181�name�argsrc��[5e)z�Returns url string for a given route name and arguments182or ``None`` if no match is found.183 184:arg str name: route name.185:arg args: url parameters.186:returns: parametrized url string for a given route name (or ``None``).187r)r!r;r<s   r"�reverse_url�ReversibleRouter.reverse_url�s
��"�#�#r%r-N)188r.r/r0r1r2�strrrr>r7r-r%r"r9r9�s%���$��$�C�$�H�S�M�$r%r9c���\rSrSrS\S\S\RSS4SjrS\	\R\R4S	\RS\
\S4S189jrS\S\
\S4SjrSS
jrSSjrSrg)r*���routerr&r'rNc�6�X lX0lSUlXlgr))r&r'�delegaterC)r!rCr&r's    r"�__init__�_RoutingDelegate.__init__�s��'��(����
��r%�190start_line�headersc��[U[R5(de[R"URUR191UUS9nURRU5UlURcF[R"SURUR5 [UR5UlURRX5$)N)�192connection�server_connectionrHrIz$Delegate for %s %s request not found)�193isinstancer�RequestStartLiner3r'r&rCr#rEr	�debug�method�path�_DefaultMessageDelegate�headers_received)r!rHrIrs    r"rS�!_RoutingDelegate.headers_received�s���194�*�h�&?�&?�@�@�@�@��,�,��(�(�"�.�.�!��	195�����0�0��9��
��=�=� ��M�M�6��!�!����
�1964�D�4E�4E�F�D�M��}�}�-�-�j�B�Br%�chunkc�V�URceURRU5$r))rE�
data_received)r!rUs  r"rW�_RoutingDelegate.data_receiveds'���}�}�(�(�(��}�}�*�*�5�1�1r%c�V�URceURR5 gr))rE�finish�r!s r"rZ�_RoutingDelegate.finishs"���}�}�(�(�(��
�
���r%c�T�URbURR5 ggr))rE�on_connection_closer[s r"r^�$_RoutingDelegate.on_connection_closes!���=�=�$��M�M�-�-�/�%r%)rEr'rCr&�rN)r.r/r0r1rr5rr6rFrrN�ResponseStartLine�HTTPHeadersrrrS�bytesrWrZr^r7r-r%r"r*r*�s������+1��AI�AX�AX��	
��C��(�3�3�X�5O�5O�O�P�C��%�%�C�197�)�D�/�	"�	C�02�5�2�X�i��o�-F�2��0r%r*c�D�\rSrSrS\R198SS4SjrSSjrSrg)	rRirKrNc��Xlgr)�rK)r!rKs  r"rF� _DefaultMessageDelegate.__init__s��$�r%c���URR[R"SSS5[R"55 URR5 g)NzHTTP/1.1i�z	Not Found)rK�
write_headersrrarbrZr[s r"rZ�_DefaultMessageDelegate.finish"sD�����%�%��&�&�z�3��D�� � �"�	199�	
����� r%rfr`)	r.r/r0r1rr6rFrZr7r-r%r"rRrRs ��%�8�#:�#:�%�t�%�!r%rR�Rule�Matcherc	���\rSrSrSrSS\\SS4SjjrS\SS4SjrSSjr	S	\200RS201\S\\202R4SjrS\S	\203RS
\S\\204R4SjrSrg)�205RuleRouteri7z!Rule-based router implementation.N�rulesrc�D�/UlU(aURU5 gg)a�Constructs a router from an ordered list of rules::206 207    RuleRouter([208        Rule(PathMatches("/handler"), Target),209        # ... more rules210    ])211 212You can also omit explicit `Rule` constructor and use tuples of arguments::213 214    RuleRouter([215        (PathMatches("/handler"), Target),216    ])217 218`PathMatches` is a default matcher, so the example above can be simplified::219 220    RuleRouter([221        ("/handler", Target),222    ])223 224In the examples above, ``Target`` can be a nested `Router` instance, an instance of225`~.httputil.HTTPServerConnectionDelegate` or an old-style callable,226accepting a request argument.227 228:arg rules: a list of `Rule` instances or tuples of `Rule`229    constructor arguments.230N)ro�	add_rules)r!ros  r"rF�RuleRouter.__init__:s��6��231���N�N�5�!�r%c�:�UH�n[U[[45(aM[U5S;de[US[5(a[[
US5/USSQ76nO[U6nURRURU55 M� g)z�Appends new rules to the router.232 233:arg rules: a list of Rule instances (or tuples of arguments, which are234    passed to Rule constructor).235)���r�N)236rM�tuple�list�lenr237rk�PathMatchesro�append�process_rule)r!ro�rules   r"rq�RuleRouter.add_rulesYs����D��$���
�.�.��4�y�I�-�-�-��d�1�g��7�7���D��G� 4�@�t�A�B�x�@�D���;�D��J�J���d�/�/��5�6�r%c��U$)z�Override this method for additional preprocessing of each rule.238 239:arg Rule rule: a rule to be processed.240:returns: the same or modified Rule instance.241r-)r!r~s  r"r}�RuleRouter.process_ruleis	���r%rrc���URHhnURRU5nUcM#UR(aURUS'UR"UR242U40UD6nUcMfUs $ g)N�
target_kwargs)ro�matcher�matchr��get_target_delegate�target)r!rrr~�
target_paramsrEs      r"r#�RuleRouter.find_handlerqsx���J�J�D� �L�L�.�.�w�7�M��(��%�%�59�5G�5G�M�/�2��3�3��K�K���,9����'�#�O��r%r�r�c�z�[U[5(aUR"U40UD6$[U[R5(a5UR243ceUR
URUR2445$[U5(a/UR245ce[[U40UD6UR2465$g)axReturns an instance of `~.httputil.HTTPMessageDelegate` for a247Rule's target. This method is called by `~.find_handler` and can be248extended to provide additional target types.249 250:arg target: a Rule's target.251:arg httputil.HTTPServerRequest request: current request.252:arg target_params: additional parameters that can be useful253    for `~.httputil.HTTPMessageDelegate` creation.254N)rMrr#r�HTTPServerConnectionDelegaterKr+rL�callablerr)r!r�rr�s    r"r��RuleRouter.get_target_delegate�s����f�f�%�%��&�&�w�@�-�@�@�
��� E� E�
F�
F��%�%�1�1�1��'�'��(A�(A�7�CU�CU�V�V�
�f�
�
��%�%�1�1�1�#���0�-�0�'�2D�2D��
�r%)ror)�r~rkrrk)r.r/r0r1r2r�	_RuleListrFrqr}rr3rr4r#r�r7r-r%r"rnrn7s���+�"�h�y�1�"�T�"�>7�y�7�T�7� ���1�1��=@��	�(�.�.�	/��$���$,�$>�$>��QT��	�(�.�.�	/�r%rnc�n^�\rSrSrSrSS\\SS4U4SjjjrS
U4SjjrS\	S	\255S\\	4S256jrSrU=r
$)�ReversibleRuleRouteri�z�A rule-based router that implements ``reverse_url`` method.257 258Each rule added to this router may have a ``name`` attribute that can be259used to reconstruct an original uri. The actual reconstruction takes place260in a rule's matcher (see `Matcher.reverse`).261Nrorc�2>�0Ul[TU]	U5 gr))�named_rules�superrF)r!ro�	__class__s  �r"rF�ReversibleRuleRouter.__init__�s������
����r%c��>�[TU]U5nUR(aSURUR;a![R262"SUR5 XRUR'U$)Nz4Multiple handlers named %s; replacing previous value)r�r}r;r�r	�warning)r!r~r�s  �r"r}�!ReversibleRuleRouter.process_rule�sY����w�#�D�)���9�9��y�y�D�,�,�,����J�D�I�I��+/���T�Y�Y�'��r%r;r<c��XR;a&URURR"U6$URHHn[	UR263[5(dM$UR264R"U/UQ76nUcMFUs $ gr))r�r��reverserorMr�r9r>)r!r;r<r~�reversed_urls     r"r>� ReversibleRuleRouter.reverse_url�sz���#�#�#��#�#�D�)�1�1�9�9�4�@�@��J�J�D��$�+�+�'7�8�8�#�{�{�6�6�t�C�d�C���+�'�'�	�r%)r�r)r�)r.r/r0r1r2rr�rFr}r@rr>r7�
__classcell__�r�s@r"r�r��sM���� �h�y�1� �T� � �265�266��267�C�268�H�S�M�269�270r%r�c�z�\rSrSrSrSSSS\S\\\\4S\\S	S4271S272jjr	S\S	\\4Sjr273S	\4S
jrSrg)rki�zA routing rule.Nr�rlr�r�r;rc��[U[5(a[U5nXlX lU(aUO0UlX@lg)a�Constructs a Rule instance.274 275:arg Matcher matcher: a `Matcher` instance used for determining276    whether the rule should be considered a match for a specific277    request.278:arg target: a Rule's target (typically a ``RequestHandler`` or279    `~.httputil.HTTPServerConnectionDelegate` subclass or even a nested `Router`,280    depending on routing implementation).281:arg dict target_kwargs: a dict of parameters that can be useful282    at the moment of target instantiation (for example, ``status_code``283    for a ``RequestHandler`` subclass). They end up in284    ``target_params['target_kwargs']`` of `RuleRouter.get_target_delegate`285    method.286:arg str name: the name of the rule that can be used to find it287    in `ReversibleRouter.reverse_url` implementation.288N)rMr@rr�r�r�r;)r!r�r�r�r;s     r"rF�
Rule.__init__�s8��.�f�c�"�"�#�6�*�F�����.;�]�����	r%r<c�4�URR"U6$r))r�r��r!r<s  r"r��Rule.reverse�s���|�|�#�#�T�*�*r%c��SRURRURURUR289UR5$�Nz${}({!r}, {}, kwargs={!r}, name={!r}))�formatr�r.r�r�r�r;r[s r"�__repr__�
Rule.__repr__�s@��5�<�<��N�N�#�#��L�L��K�K�����I�I�290�	291r%)r�r;r�r��NN)
r.r/r0r1r2rrrr@rFr�r�r7r-r%r"rkrk�sw���37�"������ ��S�#�X��/�	�292�s�m��293�
�B+�S�+�X�c�]�+�294�#�295r%c�f�\rSrSrSrS\RS\\\	\29644SjrS\297S\\	4SjrSr
g	)298rli�z*Represents a matcher for request features.rrc��[5e)a�Matches current instance against the request.299 300:arg httputil.HTTPServerRequest request: current HTTP request301:returns: a dict of parameters to be passed to the target handler302    (for example, ``handler_kwargs``, ``path_args``, ``path_kwargs``303    can be passed for proper `~.web.RequestHandler` instantiation).304    An empty dict is a valid (and common) return value to indicate a match305    when the argument-passing features are not used.306    ``None`` must be returned to indicate that there is no match.r�r!rs  r"r��
Matcher.match�s
��"�#�#r%r<c��g)zEReconstructs full url from matcher instance and additional arguments.Nr-r�s  r"r��Matcher.reverses��r%r-N)r.r/r0r1r2rr3rrr@rr�r�r7r-r%r"rlrl�sB��4�307$�X�7�7�308$�H�T�#�s�(�^�<T�309$��S��X�c�]�r%c�N�\rSrSrSrS\RS\\\	\31044SjrSrg)�311AnyMatchesi	zMatches any request.rrc��0$r)r-r�s  r"r��AnyMatches.matchs���	r%r-N)
r.r/r0r1r2rr3rrr@rr�r7r-r%r"r�r�	s+����X�7�7��H�T�#�s�(�^�<T�r%r�c�j�\rSrSrSrS\\\4SS4SjrS\	RS\\\\
44SjrS	rg)312�HostMatchesiz@Matches requests from hosts specified by ``host_pattern`` regex.�host_patternrNc��[U[5(a7URS5(dUS-
n[R"U5UlgXlg)N�$)rMr313�endswith�re�compiler�)r!r�s  r"rF�HostMatches.__init__sA���l�O�4�4��(�(��-�-���#�� "�314�315�<� 8�D�� ,�r%rc�\�URRUR5(a0$gr))r�r��	host_namer�s  r"r��HostMatches.matchs'�����"�"�7�#4�#4�5�5��I�r%)r�)r.r/r0r1r2rr@rrFrr3rrrr�r7r-r%r"r�r�sG��J�-�U�3��<�%8�-�T�-��X�7�7��H�T�#�s�(�^�<T�r%r�c�d�\rSrSrSrS\S\SS4SjrS\RS\316\\\44S	jr
S317rg)�DefaultHostMatchesi"z�Matches requests from host that is equal to application's default_host.318Always returns no match if ``X-Real-Ip`` header is present.319�applicationr�rNc��XlX lgr)�r�r�)r!r�r�s   r"rF�DefaultHostMatches.__init__'s��&��(�r%rc��SUR;a6URRURR5(a0$g)Nz	X-Real-Ip)rIr�r�r��default_hostr�s  r"r��DefaultHostMatches.match+s9���g�o�o�-�� � �&�&�t�'7�'7�'D�'D�E�E��	�r%r�)r.r/r0r1r2rrrFrr3rrr@r�r7r-r%r"r�r�"sG���)�C�)�w�)�4�)��X�7�7��H�T�#�s�(�^�<T�r%r�c��\rSrSrSrS\\\4SS4SjrS\	RS\\\\
44SjrS	\
S\\4S320jrS\\\\\44SjrSrg)
r{i3z@Matches requests with paths specified by ``path_pattern`` regex.�path_patternrNc��[U[5(a7URS5(dUS-
n[R"U5UlOXl[
UR321R5SUR322R4;dSUR323R-5eUR5uUlUlg)Nr�rzDgroups in url regexes must either be all named or all positional: %r)
rMr324r�r�r��regexrz�325groupindex�groups�pattern�_find_groups�_path�_group_count)r!r�s  r"rF�PathMatches.__init__6s����l�O�4�4��(�(��-�-���#�����L�1�D�J�%�J��4�:�:�(�(�)�a����1B�1B�-C�C�	326�
�#�z�z�1�1�
2�	327�C�328)-�(9�(9�(;�%��329�D�%r%rc���URRUR5nUcgURR(d0$/n0nURR(aFUR5R
5VVs0sHupV[U5[U5_M nnnO)UR5Vs/sHn[U5PM nn[X4S9$s snnfs snf)N)�	path_args�path_kwargs)330r�r�rQr�r��	groupdict�itemsr@�_unquote_or_none�dict)r!rr�r�r��k�v�ss        r"r��PathMatches.matchEs����331�332� � ����.���=���z�z� � ��I��	����:�:� � �:?�/�/�:K�:Q�:Q�:S��:S����A��(��+�+�:S�
��K�7<�l�l�n�E�n��)�!�,�n�I�E��i�A�A��
��Fs�!C�>C$r<c��URc"[SURR-5e[	U5UR333:XdS5e[	U5(dUR$/nUHKn[
U[[45(d[U5nUR[[U5SS95 MM UR[U5-$)NzCannot reverse url regex z&required number of arguments not foundF)�plus)r��334ValueErrorr�r�rzr�rMr
rcr@r|rrrx)r!r<�converted_args�as    r"r��PathMatches.reverse\s����:�:���8�4�:�:�;M�;M�M�N�N��4�y�D�-�-�-�	335�7�	336�-��4�y�y��:�:�����A��a�,��!6�7�7���F���!�!�*�T�!�W�5�"A�B���z�z�E�.�1�1�1r%c�z�URRnURS5(aUSSnURS5(aUSSnURRURS5:wag/nUR
S5HfnSU;a@URS5nUS	:�a'[X4S-S5nURS337U-5 MGMI[U5nURU5 Mh SRU5URR4$![a  gf=f![a  gf=f)z�Returns a tuple (reverse string, group count) for a url.338 339For example: Given the url pattern /([0-9]{4})/([a-z-]+)/, this method340would return ('/%s/%s/', 2).341�^rwNr�������(r��)rz%s�)r�r��342startswithr�r��count�split�indexrr�r|�join)r!r��pieces�fragment�	paren_loc�unescaped_fragments      r"r��PathMatches._find_groupsks:���*�*�$�$�����c�"�"��a�b�k�G����C� � ��c�r�l�G��:�:����
�
�c� 2�2�����
�
�c�*�H��h��$�N�N�3�/�	���>�,�-8��a�-�/�9R�-S�*�343�M�M�$�);�";�<�"�(�)4�X�)>�&�344�
�
�0�1�%+�(�w�w�v���345�346� 1� 1�1�1��&�,� ,�,��"�(�(�(�s$�+D�D,�347D)�(D)�,348D:�9D:)r�r�r�)r.r/r0r1r2rr@rrFrr3rrrr�r�r�intr�r7r-r%r"r{r{3s��J�
<�U�3��<�%8�
<�T�
<�B�X�7�7�B�H�T�#�s�(�^�<T�B�.
2�S�
2�X�c�]�
2�&2�e�H�S�M�8�C�=�$@�A�&2r%r{c�z^�\rSrSrSrSS\\\4S\S\	\349\\4S\	\SS4350U4S	jjjrS\4S351jrSr
U=r$)
�URLSpeci�z�Specifies mappings between URLs and handlers.352 353.. versionchanged: 4.5354   `URLSpec` is now a subclass of a `Rule` with `PathMatches` matcher and is preserved for355   backwards compatibility.356Nr��handlerrr;rc�>�[U5n[TU]	XRX45 URUlURUlX0lg)a+Parameters:357 358* ``pattern``: Regular expression to be matched. Any capturing359  groups in the regex will be passed in to the handler's360  get/post/etc methods as arguments (by keyword if named, by361  position if unnamed. Named and unnamed capturing groups362  may not be mixed in the same rule).363 364* ``handler``: `~.web.RequestHandler` subclass to be invoked.365 366* ``kwargs`` (optional): A dictionary of additional arguments367  to be passed to the handler's constructor.368 369* ``name`` (optional): A name for this handler.  Used by370  `~.web.Application.reverse_url`.371 372N)r{r�rFr�r��
handler_classr)r!r�r�rr;r�r�s      �r"rF�URLSpec.__init__�s:���0�g�&��
����6�8��]�]��373�!�[�[����r%c��SRURRURRUR374URUR5$r�)r�r�r.r�r�r�rr;r[s r"r��URLSpec.__repr__�sF��5�<�<��N�N�#�#��J�J�������K�K��I�I�375�	376r%)r�rr�r�)r.r/r0r1r2rr@rrrrrFr�r7r�r�s@r"r�r��su����,0�"���s�G�|�$������c�3�h��(�	�377�s�m��378�
��>379�#�380�381r%r�r�rc��gr)r-�r�s r"r�r�����r%c��gr)r-rs r"r�r��rr%c�"�UcU$[USSS9$)z�None-safe wrapper around url_unescape to handle unmatched optional382groups correctly.383 384Note that args are passed as bytes so the handler can decide what385encoding to use.386NF)�encodingr�)rrs r"r�r��s��	�y�����D�u�5�5r%)r�NrN)1r2r��	functoolsr�tornador�tornado.httpserverr�tornado.escaperrr�tornado.logr	�tornado.utilr387rrr
�typingrrrrrrrrrrr�rr9r4r*rRr@r�rnr�rkrlr�r�r�r{r�rcr�r-r%r"�<module>r
s���a�F388���/�9�9��R�R����A�X�
2�
2�A�.
$�v�
$� +0�x�3�3�+0�\	!�h�:�:�	!�
�	���S�	�
�e�C��N�#�S�(�)�
�e�C��N�#�S�$�s�C�x�.�8�9�
�e�C��N�#�S�$�s�C�x�.�#�=�>�		@��
�	�e��e�P"�+�Z�"�J.389�.390�b��(����'��$���"^2�'�^2�B.391�d�.392�b393�	��	��	�394�	�395�	�396�	�	6���
�	6�(�5�/�	6r%
codekingpro/portable-devtools · Team Ai