← back to Atmos Game

assets/gen/.venv/lib/python3.12/site-packages/click/__pycache__/decorators.cpython-312.pyc

230 lines

�

c�bj�L��h�ddlmZddlZddlZddlmZddlmZddl	m
Z
ddl	mZddl	mZdd	l	m
Z
dd
l	mZddl	mZddlmZdd
lmZej(rddlZej.d�Zej2d�Zej2d�Zej8dej:fZej2dd��Zd/d�Z d0d�Z!	d1					d2d�Z"dd�					d3d�Z#ej2de��Z$ejJd4d��Z&ejJ								d5d��Z&ejJ	d6							d7d��Z&ejJ	d8							d9d��Z&		d:							d;d�Z&ej2d e
��Z'ejJd<d!��Z(ejJ								d=d"��Z(ejJ	d6							d>d#��Z(ejJ	d8							d?d$��Z(		d:							d@d%�Z(dAd&�Z)dd'�							dBd(�Z*dd'�							dCd)�Z+dDd*�Z,dDd+�Z-	d6dddd,�													dEd-�Z.dDd.�Z/y)F�)�annotationsN��update_wrapper)�gettext���Argument)�Command)�Context)�Group��Option)�	Parameter��get_current_context)�echo�P�R�T.�FCz_AnyCallable | Command)�boundc�(��d�fd�}t|��S)z]Marks a callback as wanting to receive the current context
    object as first argument.
    c�,���t�g|��i|��S�Nr��args�kwargs�fs  ��g/Users/macstudio3/Projects/atmos-game/assets/gen/.venv/lib/python3.12/site-packages/click/decorators.py�new_funczpass_context.<locals>.new_func!s����$�&�8��8��8�8��rzP.argsrzP.kwargs�returnrr�rr s` r�pass_contextr%s���
9��(�A�&�&r!c�(��d�fd�}t|��S)z�Similar to :func:`pass_context`, but only pass the object on the
    context onwards (:attr:`Context.obj`).  This is useful if that object
    represents the state of a nested system.
    c�@���t�jg|��i|��Sr)r�objrs  �rr zpass_obj.<locals>.new_func-s"����$�&�*�*�<�T�<�V�<�<r!r"rr$s` r�pass_objr)'s���=��(�A�&�&r!c����d��fd�}|S)a.Given an object type this creates a decorator that will work
    similar to :func:`pass_obj` but instead of passing the object of the
    current context, it will find the innermost context of type
    :func:`object_type`.

    This generates a decorator that works roughly like this::

        from functools import update_wrapper

        def decorator(f):
            @pass_context
            def new_func(ctx, *args, **kwargs):
                obj = ctx.find_object(object_type)
                return ctx.invoke(f, obj, *args, **kwargs)
            return update_wrapper(new_func, f)
        return decorator

    :param object_type: the type of the object to pass.
    :param ensure: if set to `True`, a new object will be created and
                   remembered on the context if it's not there yet.
    c�.���d���fd�}t|��S)Nc����t�}�r|j��}n|j��}|�td�j�d���|j
�|g|��i|��S)Nz<Managed to invoke callback without a context object of type z
 existing.)r�
ensure_object�find_object�RuntimeError�__name__�invoke)rr�ctxr(�ensurer�object_types    ���rr z8make_pass_decorator.<locals>.decorator.<locals>.new_funcMsx���%�'�C���'�'��4���o�o�k�2���{�"�'�'2�';�';�&>� �!����3�:�:�a��6�t�6�v�6�6r!r"r)rr r3r4s` ��r�	decoratorz&make_pass_decorator.<locals>.decoratorLs���	7�$�h��*�*r!�rz#t.Callable[te.Concatenate[T, P], R]r#�t.Callable[P, R]�)r4r3r5s`` r�make_pass_decoratorr93s���2+�*�r!)�doc_descriptionc�:��d�fd�}|�d��d�}d|�d�|_|S)a{Create a decorator that passes a key from
    :attr:`click.Context.meta` as the first argument to the decorated
    function.

    :param key: Key in ``Context.meta`` to pass.
    :param doc_description: Description of the object being passed,
        inserted into the decorator's docstring. Defaults to "the 'key'
        key from Context.meta".

    .. versionadded:: 8.0
    c�,���d��fd�}t|��S)Nc�d��t�}|j�}|j�|g|��i|��Sr)r�metar1)rrr2r(r�keys    ��rr z2pass_meta_key.<locals>.decorator.<locals>.new_functs5���%�'�C��(�(�3�-�C��3�:�:�a��6�t�6�v�6�6r!r"r)rr r?s` �rr5z pass_meta_key.<locals>.decoratorss���	7�
�h��*�*r!zthe z$ key from :attr:`click.Context.meta`zDecorator that passes z1 as the first argument to the decorated function.r6)�__doc__)r?r:r5s`  r�
pass_meta_keyrAdsC���+��� ���'K�L��!�� 1�2&�	&����r!�CmdTypec��yrr8��names r�commandrF�s��,/r!c��yrr8�rE�cls�attrss   rrFrF����
+.r!c��yrr8rHs   rrFrF����+.r!c��yrr8rHs   rrFrF�s��+.r!c�����d}t��r�}d���Jd���rJd����tjdt��d���fd�}|�||�S|S)arCreates a new :class:`Command` and uses the decorated function as
    callback.  This will also automatically attach all decorated
    :func:`option`\s and :func:`argument`\s as parameters to the command.

    The name of the command defaults to the name of the function, converted to
    lowercase, with underscores ``_`` replaced by dashes ``-``, and the suffixes
    ``_command``, ``_cmd``, ``_group``, and ``_grp`` are removed. For example,
    ``init_data_command`` becomes ``init-data``.

    All keyword arguments are forwarded to the underlying command class.
    For the ``params`` argument, any decorated params are appended to
    the end of the list.

    Once decorated the function turns into a :class:`Command` instance
    that can be invoked as a command line utility or be attached to a
    command :class:`Group`.

    :param name: The name of the command. Defaults to modifying the function's
        name as described above.
    :param cls: The command class to create. Defaults to :class:`Command`.

    .. versionchanged:: 8.2
        The suffixes ``_command``, ``_cmd``, ``_group``, and ``_grp`` are
        removed when generating the name.

    .. versionchanged:: 8.1
        This decorator can be applied without parentheses.

    .. versionchanged:: 8.1
        The ``params`` argument can be used. Decorated params are
        appended to the end of the list.
    Nz4Use 'command(cls=cls)(callable)' to specify a class.z7Use 'command(**kwargs)(callable)' to provide arguments.�
type[CmdType]c�2��t|t�rtd���	jdd�}|�|ng}	|j}|`|jt
|���	jd��|j�	d<tjr�
�J�t��rJ����}nG|jj�jdd�}|j!d�\}}}|r|dvr|}�
d|||d��	��}|j|_	|S#t$rY��wxYw)	Nz5Attempted to convert a callback into a command twice.�params�help�_�->�cmd�grp�grouprF)rE�callbackrRr8)�
isinstancer
�	TypeError�pop�__click_params__�extend�reversed�AttributeError�getr@�t�
TYPE_CHECKING�callabler0�lower�replace�
rpartition)r�attr_paramsrR�decorator_params�cmd_name�cmd_left�sep�suffixrVrJrIrEs         ���rr5zcommand.<locals>.decorator�s%����a��!��S�T�T��i�i��$�/�� +� 7��R��	6� �1�1���"��M�M�(�#3�4�5��9�9�V��$��I�I�E�&�M��?�?��?�"�?���~�%�%����H��z�z�'�'�)�1�1�#�s�;�H�$,�$7�$7��$<�!�H�c�6��v�!C�C�#���D�x�!�F�D�e�D���i�i����
��1�	��	�s�D
�
	D�D)r�_AnyCallabler#rB)rdrb�castr
)rErIrJ�funcr5s```  rrFrF�sm���L6:�D���~������{�R�R�R�{��S�S�S�y�
�{��f�f�_�g�.��!�F�������r!�GrpTypec��yrr8rDs rrXrXs��(+r!c��yrr8rHs   rrXrXrKr!c��yrr8rHs   rrXrXrMr!c��yrr8rHs   rrXrXs��),r!c��|�tjdt�}t|�rt	dd|i|��|�St	||fi|��S)aCreates a new :class:`Group` with a function as callback.  This
    works otherwise the same as :func:`command` just that the `cls`
    parameter is set to :class:`Group`.

    .. versionchanged:: 8.1
        This decorator can be applied without parentheses.
    �
type[GrpType]rIr8)rbrorrdrFrHs   rrXrX%sL���{��f�f�_�e�,����~�(�w�(�3�(�%�(��.�.��4��&��&�&r!c��t|t�r|jj|�yt	|d�sg|_|j
j|�y)Nr])rZr
rR�append�hasattrr])r�params  r�_param_memor|:sC���!�W��	��������q�,�-�!#�A��	���!�!�%�(r!)rIc�,������t�d���fd�}|S)a�Attaches an argument to the command.  All positional arguments are
    passed as parameter declarations to :class:`Argument`; all keyword
    arguments are forwarded unchanged (except ``cls``).
    This is equivalent to creating an :class:`Argument` instance manually
    and attaching it to the :attr:`Command.params` list.

    For the default argument class, refer to :class:`Argument` and
    :class:`Parameter` for descriptions of parameters.

    :param cls: the argument class to instantiate.  This defaults to
                :class:`Argument`.
    :param param_decls: Passed as positional arguments to the constructor of
        ``cls``.
    :param attrs: Passed as keyword arguments to the constructor of ``cls``.
    c�.��t|��fi����|Sr�r|�rrJrI�param_declss ���rr5zargument.<locals>.decoratorY�����A�s�;�0�%�0�1��r!�rrr#rr�rIr�rJr5s``` r�argumentr�Ds���$�{�����r!c�,������t�d���fd�}|S)a�Attaches an option to the command.  All positional arguments are
    passed as parameter declarations to :class:`Option`; all keyword
    arguments are forwarded unchanged (except ``cls``).
    This is equivalent to creating an :class:`Option` instance manually
    and attaching it to the :attr:`Command.params` list.

    For the default option class, refer to :class:`Option` and
    :class:`Parameter` for descriptions of parameters.

    :param cls: the option class to instantiate.  This defaults to
                :class:`Option`.
    :param param_decls: Passed as positional arguments to the constructor of
        ``cls``.
    :param attrs: Passed as keyword arguments to the constructor of ``cls``.
    c�.��t|��fi����|Srrr�s ���rr5zoption.<locals>.decoratorur�r!r�r
r�s``` r�optionr�`s���$�{�����r!c��dd�}|sd}|jdd�|jd|�|jdd�|jdtd	��|jd
td��t|i|��S)
a-Add a ``--yes`` option which shows a prompt before continuing if
    not passed. If the prompt is declined, the program will exit.

    :param param_decls: One or more option names. Defaults to the single
        value ``"--yes"``.
    :param kwargs: Extra arguments are passed to :func:`option`.
    c�*�|s|j�yyr)�abort�r2r{�values   rrYz%confirmation_option.<locals>.callback�s����I�I�K�r!)z--yes�is_flagTrY�expose_valueF�promptzDo you want to continue?rSz%Confirm the action without prompting.�r2rr{rr��boolr#�None��
setdefaultrTr�)r�rrYs   r�confirmation_optionr�|s}���� ��
���i��&�
���j�(�+�
���n�e�,�
���h��"<� =�>�
���f�a� G�H�I��;�)�&�)�)r!c��|sd}|jdd�|jdd�|jdd�t|i|��S)a0Add a ``--password`` option which prompts for a password, hiding
    input and asking to enter the value again for confirmation.

    :param param_decls: One or more option names. Defaults to the single
        value ``"--password"``.
    :param kwargs: Extra arguments are passed to :func:`option`.
    )z
--passwordr�T�confirmation_prompt�
hide_input)r�r�)r�rs  r�password_optionr��sM���%��
���h��%�
���+�T�2�
���l�D�)��;�)�&�)�)r!)�package_name�	prog_name�messagec���������td����v��ttj�}|�|jnd}|�|jnd}~|�=|jd���dk(r|jd���r�j
d�d�d����fd�}	|sd	}|jd
d�|jdd
�|jdd�|jdtd��|	|d<t|i|��S)a�Add a ``--version`` option which immediately prints the version
    number and exits the program.

    If ``version`` is not provided, Click will try to detect it using
    :func:`importlib.metadata.version` to get the version for the
    ``package_name``.

    If ``package_name`` is not provided, Click will try to detect it by
    inspecting the stack frames. If the detected (or given) name does
    not match an installed distribution, Click resolves it as an import
    (top-level module) name via
    :func:`importlib.metadata.packages_distributions`, so e.g. ``PIL``
    resolves to the ``Pillow`` distribution.

    :param version: The version number to show. If not provided, Click
        will try to detect it.
    :param param_decls: One or more option names. Defaults to the single
        value ``"--version"``.
    :param package_name: The package name to detect the version from. If
        not provided, Click will try to detect it.
    :param prog_name: The name of the CLI to show in the message. If not
        provided, it will be detected from the command.
    :param message: The message to show. The values ``%(prog)s``,
        ``%(package)s``, and ``%(version)s`` are available. Defaults to
        ``"%(prog)s, version %(version)s"``.
    :param kwargs: Extra arguments are passed to :func:`option`.
    :raise RuntimeError: ``version`` could not be detected.

    .. versionchanged:: 8.0
        Add the ``package_name`` parameter, and the ``%(package)s``
        value for messages.

    .. versionchanged:: 8.0
        Use :mod:`importlib.metadata` instead of ``pkg_resources``. The
        version is detected based on the package name, not the entry
        point name. The Python package name must match the installed
        package name, or be passed with ``package_name=``.

    .. versionchanged:: 8.4.2
        When ``package_name`` does not match an installed distribution,
        Click now resolves it as an import (top-level module).
    Nz%(prog)s, version %(version)sr0�__main__�__package__�.rc���|r|jry��|j�j���"�� ddl}	|jj�����td��d���t����d	�z|j�
�|j�y#|jj$r�|jj�j�g�}t|�dk(r!|d�|jj���n>t|�dkDr!t��ddj|��d��d�t��d��d�Y��wxYw)Nrrz+ maps to multiple installed distributions (z, z'). Pass 'package_name' to disambiguate.z6 is not installed. Try passing 'package_name' instead.z$Could not determine the version for z automatically.)�prog�package�version��color)�resilient_parsing�	find_root�	info_name�importlib.metadata�metadatar��PackageNotFoundError�packages_distributionsra�lenr/�joinrr��exit)	r2r{r��	importlib�
distributionsr�r�r�r�s	     ����rrYz version_option.<locals>.callback�s�����-�-�����
�
��1�1�I��?�|�7�%�
 �#�,�,�4�4�\�B��.�?��6�|�6F�o�V��
�	
��y�\�g�V�V��)�)�	
�	���
��?�%�%�:�:�
 �!*� 2� 2� I� I� K� O� O� �"�!�
��}�%��*�#0��#3�L�'�0�0�8�8��F�G���'�!�+�&�'�*�++�+/�9�9�]�+C�*D�E@�@�� �	 �'�'�*�+3�3�� � ��
 �s�B�B0E�E)z	--versionr�Tr�F�is_eagerrSzShow the version and exit.rYr�)	rT�inspect�currentframe�f_back�	f_globalsra�	partitionr�r�)
r�r�r�r�r�r�framer�r�rYs
````      r�version_optionr��s���d���3�4����<�/��$�$�&��!&�!2������(.�(:�F�$�$��	�
�� �$�=�=��4�L��z�)�(�}�}�]�;���+�5�5�c�:�1�=��/�/�b�$��
���i��&�
���n�e�,�
���j�$�'�
���f�a� <�=�>�!�F�:���;�)�&�)�)r!c���dd�}|sd}|jdd�|jdd�|jdd�|jdtd	��|jd
|�t|i|��S)aPre-configured ``--help`` option which immediately prints the help page
    and exits the program.

    :param param_decls: One or more option names. Defaults to the single
        value ``"--help"``.
    :param kwargs: Extra arguments are passed to :func:`option`.
    c��|rC|js6t|j�|j��|j	�yyy)z<Callback that print the help page on ``<stdout>`` and exits.r�N)r�r�get_helpr�r�r�s   r�	show_helpzhelp_option.<locals>.show_help0s1����.�.������s�y�y�1��H�H�J�/�5r!)z--helpr�Tr�Fr�rSzShow this message and exit.rYr�r�)r�rr�s   r�help_optionr�'sw����!��
���i��&�
���n�e�,�
���j�$�'�
���f�a� =�>�?�
���j�)�,��;�)�&�)�)r!)rz)t.Callable[te.Concatenate[Context, P], R]r#r7r6)F)r4ztype[T]r3r�r#�Ct.Callable[[t.Callable[te.Concatenate[T, P], R]], t.Callable[P, R]])r?�strr:�
str | Noner#r�)rErnr#r
)rEr�rIrPrJ�t.Anyr#�#t.Callable[[_AnyCallable], CmdType]r)rEr�rIrPrJr�r#r�).N)rEr�rIr�rJr�r#z#t.Callable[[_AnyCallable], Command])NN)rE�str | _AnyCallable | NonerIztype[CmdType] | NonerJr�r#z7Command | t.Callable[[_AnyCallable], Command | CmdType])rErnr#r)rEr�rIrwrJr�r#�#t.Callable[[_AnyCallable], GrpType])rEr�rIrwrJr�r#r�)rEr�rIr�rJr�r#z!t.Callable[[_AnyCallable], Group])rEr�rIztype[GrpType] | NonerJr�r#z3Group | t.Callable[[_AnyCallable], Group | GrpType])rzt.Callable[..., t.Any]r{rr#r�)r�r�rIztype[Argument] | NonerJr�r#�t.Callable[[FC], FC])r�r�rIztype[Option] | NonerJr�r#r�)r�r�rr�r#r�)r�r�r�r�r�r�r�r�r�r�rr�r#r�)0�
__future__rr��typingrb�	functoolsrrrT�corer	r
rrrr�globalsr�utilsrrc�typing_extensions�te�	ParamSpecr�TypeVarrr�Callable�Anyrnrr%r)r9rArB�overloadrFrqrXr|r�r�r�r�r�r�r8r!r�<module>r�s���"���$� �������(���?�?�"�����S��A�
�A�I�I�c�N��
�A�I�I�c�N���z�z�#�q�u�u�*�%���Q�Y�Y�t�3�4��'�	'�*/�.��.�"&�.�H�.�d04��	��",��H��B�!�)�)�I�W�
-�����/��/�
���.�
�.�	�.��.�)�	.��.�����.�
�.�
�.��	.�
)�.��.����(,�.�
�.�!%�.�7<�.�(�.��.�'+� $�W�
#�W�	�W��W�=�	W�t�!�)�)�I�U�
+�����+��+�
���.�
�.�	�.��.�)�	.��.�����.�
�.�
�.��	.�
)�.��.����(,�,�
�,�!%�,�7<�,�&�,��,�'+� $�'�
#�'�	�'��'�9�	'�*)�59����1��CH����:37����/��AF����8*�0*�$�*� $� ��*�
�*��*��*��	*�
�*��
*��*�D*r!