HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /lib/python3/dist-packages/setuptools/_vendor/jaraco/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/setuptools/_vendor/jaraco/__pycache__/functools.cpython-311.pyc
�

���c�4��B�ddlZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
e
de	def���Zd�Z
d�Zd�Zej��fd	ed
e	egefdefd�Zd
�Zd�Zd�Zd�ZGd�d��Zd�Zd�ddfd�Zd�Zd�Zd�Zd�Zd�Zddd�d�ZdS)�N)�Callable�TypeVar�	CallableT.)�boundc�2�d�}tj||��S)a;
    Compose any number of unary functions into a single unary function.

    >>> import textwrap
    >>> expected = str.strip(textwrap.dedent(compose.__doc__))
    >>> strip_and_dedent = compose(str.strip, textwrap.dedent)
    >>> strip_and_dedent(compose.__doc__) == expected
    True

    Compose also allows the innermost function to take arbitrary arguments.

    >>> round_three = lambda x: round(x, ndigits=3)
    >>> f = compose(round_three, int.__truediv__)
    >>> [f(3*x, x+1) for x in range(1,10)]
    [1.5, 2.0, 2.25, 2.4, 2.5, 2.571, 2.625, 2.667, 2.7]
    c������fd�S)Nc�&����|i|����S�N�)�args�kwargs�f1�f2s  ���E/usr/lib/python3/dist-packages/setuptools/_vendor/jaraco/functools.py�<lambda>z.compose.<locals>.compose_two.<locals>.<lambda>#s ���r�r�"�"�d�*=�f�*=�*=�'>�'>��r)rrs``r�compose_twozcompose.<locals>.compose_two"s����>�>�>�>�>�>r)�	functools�reduce)�funcsrs  r�composers&��$?�?�?���K��/�/�/rc��������fd�}|S)z�
    Return a function that will call a named method on the
    target object with optional positional and keyword
    arguments.

    >>> lower = method_caller('lower')
    >>> lower('MyString')
    'mystring'
    c�4��t|���}|�i���Sr
)�getattr)�target�funcrr
�method_names  ���r�call_methodz"method_caller.<locals>.call_method3s'����v�{�+�+���t�T�$�V�$�$�$rr)rrr
rs``` r�
method_callerr(s0�����%�%�%�%�%�%�%��rc�^���tj�����fd�����fd��_�S)ad
    Decorate func so it's only ever called the first time.

    This decorator can ensure that an expensive or non-idempotent function
    will not be expensive on subsequent calls and is idempotent.

    >>> add_three = once(lambda a: a+3)
    >>> add_three(3)
    6
    >>> add_three(9)
    6
    >>> add_three('12')
    6

    To reset the stored value, simply clear the property ``saved_result``.

    >>> del add_three.saved_result
    >>> add_three(9)
    12
    >>> add_three(8)
    12

    Or invoke 'reset()' on it.

    >>> add_three.reset()
    >>> add_three(-3)
    0
    >>> add_three(0)
    0
    c�L��t�d��s
�|i|���_�jS�N�saved_result)�hasattrr#)rr
r�wrappers  ��rr%zonce.<locals>.wrapperZs5����w��/�/�	9�#'�4��#8��#8�#8�G� ��#�#rc�H��t����d��Sr")�vars�__delitem__)r%s�rrzonce.<locals>.<lambda>`s���D��M�M�5�5�n�E�E�r)r�wraps�reset�rr%s`@r�oncer,:sR����@�_�T���$�$�$�$�$���$�
F�E�E�E�G�M��Nr�method�
cache_wrapper�returnc����dtdtdtdtf��fd�}d�|_t����p|S)aV
    Wrap lru_cache to support storing the cache data in the object instances.

    Abstracts the common paradigm where the method explicitly saves an
    underscore-prefixed protected property on first call and returns that
    subsequently.

    >>> class MyClass:
    ...     calls = 0
    ...
    ...     @method_cache
    ...     def method(self, value):
    ...         self.calls += 1
    ...         return value

    >>> a = MyClass()
    >>> a.method(3)
    3
    >>> for x in range(75):
    ...     res = a.method(x)
    >>> a.calls
    75

    Note that the apparent behavior will be exactly like that of lru_cache
    except that the cache is stored on each instance, so values in one
    instance will not flush values from another, and when an instance is
    deleted, so are the cached values for that instance.

    >>> b = MyClass()
    >>> for x in range(35):
    ...     res = b.method(x)
    >>> b.calls
    35
    >>> a.method(0)
    0
    >>> a.calls
    75

    Note that if method had been decorated with ``functools.lru_cache()``,
    a.calls would have been 76 (due to the cached value of 0 having been
    flushed by the 'b' instance).

    Clear the cache with ``.cache_clear()``

    >>> a.method.cache_clear()

    Same for a method that hasn't yet been called.

    >>> c = MyClass()
    >>> c.method.cache_clear()

    Another cache wrapper may be supplied:

    >>> cache = functools.lru_cache(maxsize=2)
    >>> MyClass.method2 = method_cache(lambda self: 3, cache_wrapper=cache)
    >>> a = MyClass()
    >>> a.method2()
    3

    Caution - do not subsequently wrap the method with another decorator, such
    as ``@property``, which changes the semantics of the function.

    See also
    http://code.activestate.com/recipes/577452-a-memoize-decorator-for-instance-methods/
    for another implementation and additional justification.
    �selfrr
r/c���tj�|��}�|��}t|�j|��||i|��Sr
)�types�
MethodType�setattr�__name__)r1rr
�bound_method�
cached_methodr.r-s     ��rr%zmethod_cache.<locals>.wrapper�sT���"'�"2��D�#
�#
��&�
�l�3�3�
���f�o�}�5�5�5��}�d�-�f�-�-�-rc��dSr
rrrrrzmethod_cache.<locals>.<lambda>�s��$�r)�object�cache_clear�_special_method_cache)r-r.r%s`` r�method_cacher=dsi����R.�f�.�V�.�v�.�&�.�.�.�.�.�.�.�'�,�G��	�f�m�4�4�?��rc�B�����j}d}||vrdSd|z����fd�}|S)a:
    Because Python treats special methods differently, it's not
    possible to use instance attributes to implement the cached
    methods.

    Instead, install the wrapper method under a different name
    and return a simple proxy to that wrapper.

    https://github.com/jaraco/jaraco.functools/issues/5
    )�__getattr__�__getitem__N�__cachedc����t|��vr2tj�|��}�|��}t|�|��nt	|���}||i|��Sr
)r'r3r4r5r)r1rr
r�cacher.r-�wrapper_names     ���r�proxyz$_special_method_cache.<locals>.proxy�sn����t�D�z�z�)�)��$�V�T�2�2�E�!�M�%�(�(�E��D�,��.�.�.�.��D�,�/�/�E��u�d�%�f�%�%�%r)r6)r-r.�name�
special_namesrErDs``   @rr<r<�sW������?�D�0�M��=� � �����$�L�&�&�&�&�&�&�&��Lrc����fd�}|S)ab
    Decorate a function with a transform function that is
    invoked on results returned from the decorated function.

    >>> @apply(reversed)
    ... def get_numbers(start):
    ...     "doc for get_numbers"
    ...     return range(start, start+3)
    >>> list(get_numbers(4))
    [6, 5, 4]
    >>> get_numbers.__doc__
    'doc for get_numbers'
    c�Z��tj|��t�|����Sr
)rr)r)r�	transforms �r�wrapzapply.<locals>.wrap�s'���$�y��t�$�$�W�Y��%=�%=�>�>�>rr)rJrKs` r�applyrL�s#���?�?�?�?�?��Krc����fd�}|S)a@
    Decorate a function with an action function that is
    invoked on the results returned from the decorated
    function (for its side-effect), then return the original
    result.

    >>> @result_invoke(print)
    ... def add_two(a, b):
    ...     return a + b
    >>> x = add_two(2, 3)
    5
    >>> x
    5
    c�J���tj�����fd���}|S)Nc�.���|i|��}�|��|Sr
r)rr
�result�actionrs   ��rr%z,result_invoke.<locals>.wrap.<locals>.wrappers)����T�4�*�6�*�*�F��F�6�N�N�N��Mr�rr))rr%rQs` �rrKzresult_invoke.<locals>.wraps>����	���	�	�	�	�	�	�	�
�	�	�
�rr)rQrKs` r�
result_invokerS�s#��� ������Krc��||i|��|S)ab
    Call a function for its side effect after initialization.

    >>> @call_aside
    ... def func(): print("called")
    called
    >>> func()
    called

    Use functools.partial to pass parameters to the initial call

    >>> @functools.partial(call_aside, name='bingo')
    ... def func(name): print("called with", name)
    called with bingo
    r)�frr
s   r�
call_asiderV
s�� �A�t��v�����Hrc�H�eZdZdZed��fd�Zd�Zd�Zd�Zd	d�Z	dS)
�	Throttlerz3
    Rate-limit a function (or other callable)
    �Infc��t|t��r|j}||_||_|���dSr
)�
isinstancerXr�max_rater*)r1rr\s   r�__init__zThrottler.__init__&s:���d�I�&�&�	��9�D���	� ��
��
�
�����rc��d|_dS)Nr)�last_called)r1s rr*zThrottler.reset-s������rc�D�|���|j|i|��Sr
)�_waitr)r1rr
s   r�__call__zThrottler.__call__0s&���
�
�����t�y�$�)�&�)�)�)rc���tj��|jz
}d|jz|z
}tjt	d|����tj��|_dS)z1ensure at least 1/max_rate seconds from last call�rN)�timer_r\�sleep�max)r1�elapsed�	must_waits   rrazThrottler._wait4sT���)�+�+�� 0�0����
�%��/�	��
�3�q�)�$�$�%�%�%��9�;�;����rNc�\�t|jtj|j|����Sr
)�first_invokerar�partialr)r1�obj�types   r�__get__zThrottler.__get__;s#���D�J�	�(9�$�)�S�(I�(I�J�J�Jrr
)
r6�
__module__�__qualname__�__doc__�floatr]r*rbrarorrrrXrX!s���������',�e�E�l�l��������*�*�*�'�'�'�K�K�K�K�K�KrrXc������fd�}|S)z�
    Return a function that when invoked will invoke func1 without
    any parameters (for its side-effect) and then invoke func2
    with whatever parameters were passed, returning its result.
    c�(������|i|��Sr
r)rr
�func1�func2s  ��rr%zfirst_invoke.<locals>.wrapperFs#���
������u�d�%�f�%�%�%rr)rvrwr%s`` rrkrk?s)����&�&�&�&�&�&��Nrc��dSr
rrrrrrMs��T�rrc���|td��krtj��nt|��}|D]#}	|��cS#|$r
|��Y� wxYw|��S)z�
    Given a callable func, trap the indicated exceptions
    for up to 'retries' times, invoking cleanup on the
    exception. On the final attempt, allow any exceptions
    to propagate.
    �inf)rs�	itertools�count�range)r�cleanup�retries�trap�attempts�attempts      r�
retry_callr�Ms���%,�u�U�|�|�$;�$;�y�� � � ��w���H�����	��4�6�6�M�M�M���	�	�	��G�I�I�I�I�I�	�����4�6�6�Ms�	A�A�Ac������fd�}|S)a7
    Decorator wrapper for retry_call. Accepts arguments to retry_call
    except func and then returns a decorator for the decorated function.

    Ex:

    >>> @retry(retries=3)
    ... def my_func(a, b):
    ...     "this is my funk"
    ...     print(a, b)
    >>> my_func.__doc__
    'this is my funk'
    c�L���tj������fd���}|S)Nc�N��tj�g|�Ri|��}t|g��Ri���Sr
)rrlr�)�f_args�f_kwargsrr�r_args�r_kwargss   ���rr%z(retry.<locals>.decorate.<locals>.wrappernsA����%�d�@�V�@�@�@�x�@�@�E��e�9�f�9�9�9��9�9�9rrR)rr%r�r�s` ��r�decoratezretry.<locals>.decoratemsC����	���	�	�	:�	:�	:�	:�	:�	:�
�	�	:��rr)r�r�r�s`` r�retryr�^s)�����������Orc��tjtt��}t	t
j||��}tj|��|��S)z�
    Convert a generator into a function that prints all yielded elements

    >>> @print_yielded
    ... def x():
    ...     yield 3; yield None
    >>> x()
    3
    None
    )rrl�map�printr�more_itertools�consumer))r�	print_all�
print_resultss   r�
print_yieldedr�xsD���!�#�u�-�-�I��N�2�I�t�D�D�M� �9�?�4� � ��/�/�/rc�F��tj����fd���}|S)z�
    Wrap func so it's not called if its first param is None

    >>> print_text = pass_none(print)
    >>> print_text('text')
    text
    >>> print_text(None)
    c�$��|��|g|�Ri|��SdSr
r)�paramrr
rs   �rr%zpass_none.<locals>.wrapper�s1������4��/��/�/�/��/�/�/��rrRr+s` r�	pass_noner��s:����_�T���0�0�0�0���0��Nrc���tj|��}|j���}�fd�|D��}t	j|fi|��S)a�
    Assign parameters from namespace where func solicits.

    >>> def func(x, y=3):
    ...     print(x, y)
    >>> assigned = assign_params(func, dict(x=2, z=4))
    >>> assigned()
    2 3

    The usual errors are raised if a function doesn't receive
    its required parameters:

    >>> assigned = assign_params(func, dict(y=3, z=4))
    >>> assigned()
    Traceback (most recent call last):
    TypeError: func() ...argument...

    It even works on methods:

    >>> class Handler:
    ...     def meth(self, arg):
    ...         print(arg)
    >>> assign_params(Handler().meth, dict(arg='crystal', foo='clear'))()
    crystal
    c�*��i|]}|�v�|�|��Srr)�.0�k�	namespaces  �r�
<dictcomp>z!assign_params.<locals>.<dictcomp>�s$���A�A�A�1�!�y�.�.�q�)�A�,�.�.�.r)�inspect�	signature�
parameters�keysrrl)rr��sig�params�call_nss `   r�
assign_paramsr��sZ���4�
�D�
!�
!�C�
�^�
 �
 �
"�
"�F�A�A�A�A��A�A�A�G���T�-�-�W�-�-�-rc�t���tjdd���tj�����fd���}|S)a&
    Wrap a method such that when it is called, the args and kwargs are
    saved on the method.

    >>> class MyClass:
    ...     @save_method_args
    ...     def method(self, a, b):
    ...         print(a, b)
    >>> my_ob = MyClass()
    >>> my_ob.method(1, 2)
    1 2
    >>> my_ob._saved_method.args
    (1, 2)
    >>> my_ob._saved_method.kwargs
    {}
    >>> my_ob.method(a=3, b='foo')
    3 foo
    >>> my_ob._saved_method.args
    ()
    >>> my_ob._saved_method.kwargs == dict(a=3, b='foo')
    True

    The arguments are stored on the instance, allowing for
    different instance to save different args.

    >>> your_ob = MyClass()
    >>> your_ob.method({str('x'): 3}, b=[4])
    {'x': 3} [4]
    >>> your_ob._saved_method.args
    ({'x': 3},)
    >>> my_ob._saved_method.args
    ()
    �args_and_kwargszargs kwargsc�j��d�jz}�||��}t|||���|g|�Ri|��S)N�_saved_)r6r5)r1rr
�	attr_name�attrr�r-s     ��rr%z!save_method_args.<locals>.wrapper�sR������/�	���t�V�,�,����i��&�&�&��v�d�,�T�,�,�,�V�,�,�,r)�collections�
namedtuplerr))r-r%r�s` @r�save_method_argsr��sT����D"�,�->�
�N�N�O��_�V���-�-�-�-�-���-��Nr)�replace�usec��������fd�}|S)a-
    Replace the indicated exceptions, if raised, with the indicated
    literal replacement or evaluated expression (if present).

    >>> safe_int = except_(ValueError)(int)
    >>> safe_int('five')
    >>> safe_int('5')
    5

    Specify a literal replacement with ``replace``.

    >>> safe_int_r = except_(ValueError, replace=0)(int)
    >>> safe_int_r('five')
    0

    Provide an expression to ``use`` to pass through particular parameters.

    >>> safe_int_pt = except_(ValueError, use='args[0]')(int)
    >>> safe_int_pt('five')
    'five'

    c�N���tj�������fd���}|S)Nc�t��	�|i|��S#�$r'	t���cYS#t$r�cYcYSwxYwwxYwr
)�eval�	TypeError)rr
�
exceptionsrr�r�s  ����rr%z*except_.<locals>.decorate.<locals>.wrappersw���
#��t�T�,�V�,�,�,���
#�
#�
#�#���9�9�$�$�$�� �#�#�#�"�N�N�N�N�N�#����
#���s ��7�"�7�3�7�3�7rR)rr%r�r�r�s` ���rr�zexcept_.<locals>.decoratesH����	���	�	�	#�	#�	#�	#�	#�	#�	#�
�	�	#��rr)r�r�r�r�s``` r�except_r��s/�����0��������Or)rrer�r�r3r{� setuptools.extern.more_itertools�
setuptools�typingrrr:rrrr,�	lru_cacher=r<rLrSrVrXrkr�r�r�r�r�r�r�rrr�<module>r�s!��������������������������'�'�'�'�$�$�$�$�$�$�$�$�
�G�K�x��V��'<�=�=�=�	�0�0�0�0���$'�'�'�\	�	����	W�W��W��	��Y���W�
�W�W�W�W�t���<���*���8
�
�
�(K�K�K�K�K�K�K�K�<���*�\�1�2�����"���4
0�
0�
0� ���$.�.�.�@+�+�+�\"&�4�%�%�%�%�%�%�%r