Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
views.cpython-313.pyc88 linesDownload Raw Back to __pycache__
1�

2��j2����SSKJr SSKrSSKJr SSKJr SSKJr \R"S\RS\R4S	9r\
"/S3Q5r"SS5r"S
S\5rg)�)�annotationsN�)�typing)�current_app)�request�F.)�bound)�get�post�head�options�delete�put�trace�patchc��\rSrSr%SrSrS\S'SrS\S'/rS\S	'S4r	S\S'SS
jr5\SSj5rSr
g)�View�a�Subclass this class and override :meth:`dispatch_request` to6create a generic class-based view. Call :meth:`as_view` to create a7view function that creates an instance of the class with the given8arguments and calls its ``dispatch_request`` method with any URL9variables.10 11See :doc:`views` for a detailed guide.12 13.. code-block:: python14 15    class Hello(View):16        init_every_request = False17 18        def dispatch_request(self, name):19            return f"Hello, {name}!"20 21    app.add_url_rule(22        "/hello/<name>", view_func=Hello.as_view("hello")23    )24 25Set :attr:`methods` on the class to change what methods the view26accepts.27 28Set :attr:`decorators` on the class to apply a list of decorators to29the generated view function. Decorators applied to the class itself30will not be applied to the generated view function!31 32Set :attr:`init_every_request` to ``False`` for efficiency, unless33you need to store request-global data on ``self``.34Nz$t.ClassVar[t.Collection[str] | None]�methodszt.ClassVar[bool | None]�provide_automatic_optionsz(t.ClassVar[list[t.Callable[..., t.Any]]]�35decoratorsTzt.ClassVar[bool]�init_every_requestc��[5e)z�The actual view function behavior. Subclasses must override36this and return a valid response. Any variables from the URL37rule are passed as keyword arguments.38)�NotImplementedError)�selfs �QD:\code\apps\devtools\python\user_packages\Python313\site-packages\flask/views.py�dispatch_request�View.dispatch_requestNs
��39"�#�#�c�^^^^�UR(aSUUU4SjjmOU"T0TD6mSU4SjjmUR(a3UTlURTlURHnU"T5mM
 UTlUTlUR40TlURTlURTlURTlT$)aConvert the class into a view function that can be registered41for a route.42 43By default, the generated view will create a new instance of the44view class for every request and call its45:meth:`dispatch_request` method. If the view class sets46:attr:`init_every_request` to ``False``, the same instance will47be used for every request.48 49Except for ``name``, all other arguments passed to this method50are forwarded to the view class ``__init__`` method.51 52.. versionchanged:: 2.253    Added the ``init_every_request`` class attribute.54c�t>�TR"T0TD6n[R"UR5"S0UD6$�N�)�55view_classr�ensure_syncr)�kwargsr�56class_args�class_kwargs�views  ���rr)�View.as_view.<locals>.viewjs=��������#/���#�.�.�t�/D�/D�E�O��O�Orc�P>�[R"TR5"S0UD6$r")rr%r)r&rs �rr)r*ss"���"�.�.�t�/D�/D�E�O��O�Or�r&�t.Any�return�ft.ResponseReturnValue)rr�__name__�57__module__r$�__doc__rr)�cls�namer'r(�	decoratorrr)s  `` @@r�as_view�View.as_viewUs����&�!�!�
P�
P��58�3�l�3�D�
P��>�>� �D�M�!�n�n�D�O� �^�^�	� ����,������
��{�{����.�.����{�{���),�)F�)F��&��rr#)r.r/)r4�strr'r-r(r-r.zft.RouteCallable)r0r1�__qualname__�__firstlineno__r2r�__annotations__rrrr�classmethodr6�__static_attributes__r#rrrrsw���D59�G�
1�8�59:>��6�=�<>�J�8�=�,0��(�/�$��1��1�%*�1�<A�1�	�1��1rrc�:^�\rSrSrSrSU4SjjrSSjrSrU=r$)�60MethodView�a�Dispatches request methods to the corresponding instance methods.61For example, if you implement a ``get`` method, it will be used to62handle ``GET`` requests.63 64This can be useful for defining a REST API.65 66:attr:`methods` is automatically set based on the methods defined on67the class.68 69See :doc:`views` for a detailed guide.70 71.. code-block:: python72 73    class CounterAPI(MethodView):74        def get(self):75            return str(session.get("counter", 0))76 77        def post(self):78            session["counter"] = session.get("counter", 0) + 179            return redirect(url_for("counter"))80 81    app.add_url_rule(82        "/counter", view_func=CounterAPI.as_view("counter")83    )84c�x>�[TU]"S0UD6 SUR;a�[5nURH2n[USS5(dMUR
UR5 M4 [H4n[X5(dMURUR55 M6 U(aX lggg)Nrr#)�super�__init_subclass__�__dict__�set�	__bases__�getattr�updater�http_method_funcs�hasattr�add�upper)r3r&r�base�key�	__class__s     �rrC�MethodView.__init_subclass__�s����
��!�+�F�+��C�L�L�(��e�G��
�
���4��D�1�1��N�N�4�<�<�0�&�)���3�$�$��K�K��	�	��,�)��%���)rc��[U[RR5S5nUc![RS:Xa
[USS5nUcS[R<35e[R85"U5"S0UD6$)N�HEADr86zUnimplemented method r#)rGr�method�lowerrr%)rr&�meths   rr�MethodView.dispatch_request�st���t�W�^�^�1�1�3�T�:���<�G�N�N�f�4��4���-�D���K�#8����8J�!K�K���&�&�t�,�6�v�6�6rr#)r&r-r.�Noner,)	r0r1r9r:r2rCrr=�
__classcell__)rOs@rr?r?�s����4&�"	7�	7rr?)�87__future__rr�t��ft�globalsrr�TypeVar�Callable�Anyr�	frozensetrIrr?r#rr�<module>rbs\��"��� ���I�I�c����C����J�/�0���I���88w�w�t57��57r
codekingpro/portable-devtools · Team Ai