Sh3ll
OdayForums


Server : Apache
System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64
User : nobody ( 99)
PHP Version : 8.1.23
Disable Function : NONE
Directory :  /opt/alt/python311/lib64/python3.11/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/alt/python311/lib64/python3.11/__pycache__/functools.cpython-311.pyc
�

�,d
�����dZgd�ZddlmZddlmZddlmZddlm	Z	ddl
mZdZd	Z
ee
fd
�Zee
fd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zdefdefdefgdefdefdefgdefdefdefgdefdefdefgd�Zd�Zd�Z	ddlmZn#e $rYnwxYwe!��Z"e"fd �Z#	dd!lm#Z#n#e $rYnwxYwGd"�d#��Z$	dd$lm$Z$n#e $rYnwxYwGd%�d&e!��Z%d'�Z&ed(gd)���Z'Gd*�d+e(��Z)e!��fe*e+he,e-e.fd,�Z/d=d/�Z0d0�Z1	dd1lm1Z1n#e $rYnwxYwd2�Z2d3�Z3d>d5�Z4d6�Z5d7�Z6d8�Z7Gd9�d:��Z8e!��Z9Gd;�d<��Z:d4S)?zEfunctools.py - Tools for working with functions and callable objects
)�update_wrapper�wraps�WRAPPER_ASSIGNMENTS�WRAPPER_UPDATES�total_ordering�cache�
cmp_to_key�	lru_cache�reduce�partial�
partialmethod�singledispatch�singledispatchmethod�cached_property�)�get_cache_token)�
namedtuple)�recursive_repr)�RLock)�GenericAlias)�
__module__�__name__�__qualname__�__doc__�__annotations__)�__dict__c���|D]4}	t||��}t|||���%#t$rY�1wxYw|D]4}t||���t||i�����5||_|S)aUpdate a wrapper function to look like the wrapped function

       wrapper is the function to be updated
       wrapped is the original function
       assigned is a tuple naming the attributes assigned directly
       from the wrapped function to the wrapper function (defaults to
       functools.WRAPPER_ASSIGNMENTS)
       updated is a tuple naming the attributes of the wrapper that
       are updated with the corresponding attribute from the wrapped
       function (defaults to functools.WRAPPER_UPDATES)
    )�getattr�setattr�AttributeError�update�__wrapped__)�wrapper�wrapped�assigned�updated�attr�values      �0/opt/alt/python311/lib64/python3.11/functools.pyrr#s����*�*��	*��G�T�*�*�E�
�G�T�5�)�)�)�)���	�	�	��D�	�����B�B�������%�%�g�g�t�R�&@�&@�A�A�A�A�"�G���Ns�(�
5�5c�2�tt|||���S)a�Decorator factory to apply update_wrapper() to a wrapper function

       Returns a decorator that invokes update_wrapper() with the decorated
       function as the wrapper argument and the arguments to wraps() as the
       remaining arguments. Default arguments are as for update_wrapper().
       This is a convenience function to simplify applying partial() to
       update_wrapper().
    �r#r$r%)rrr*s   r(rrAs$���>�7�$�g�7�7�7�7�c�p�t|���||��}|tur|S|o||kS)zIReturn a > b.  Computed by @total_ordering from (not a < b) and (a != b).��type�__lt__�NotImplemented��self�other�	op_results   r(�_gt_from_ltr5Y�?���T�
�
�!�!�$��.�.�I��N�"�"����=�*�T�U�]�*r+c�n�t|���||��}|tur|S|p||kS)zEReturn a <= b.  Computed by @total_ordering from (a < b) or (a == b).r-r1s   r(�_le_from_ltr8`�=���T�
�
�!�!�$��.�.�I��N�"�"����%���
�%r+c�d�t|���||��}|tur|S|S)z=Return a >= b.  Computed by @total_ordering from (not a < b).r-r1s   r(�_ge_from_ltr;g�6���T�
�
�!�!�$��.�.�I��N�"�"����=�r+c�p�t|���||��}|tur|S|p||kS)zJReturn a >= b.  Computed by @total_ordering from (not a <= b) or (a == b).�r.�__le__r0r1s   r(�_ge_from_ler@n�?���T�
�
�!�!�$��.�.�I��N�"�"����=�)�D�E�M�)r+c�n�t|���||��}|tur|S|o||kS)zFReturn a < b.  Computed by @total_ordering from (a <= b) and (a != b).r>r1s   r(�_lt_from_lerCu�=���T�
�
�!�!�$��.�.�I��N�"�"����&����&r+c�d�t|���||��}|tur|S|S)z=Return a > b.  Computed by @total_ordering from (not a <= b).r>r1s   r(�_gt_from_lerF|r<r+c�p�t|���||��}|tur|S|o||kS)zIReturn a < b.  Computed by @total_ordering from (not a > b) and (a != b).�r.�__gt__r0r1s   r(�_lt_from_gtrJ�r6r+c�n�t|���||��}|tur|S|p||kS)zEReturn a >= b.  Computed by @total_ordering from (a > b) or (a == b).rHr1s   r(�_ge_from_gtrL�r9r+c�d�t|���||��}|tur|S|S)z=Return a <= b.  Computed by @total_ordering from (not a > b).rHr1s   r(�_le_from_gtrN�r<r+c�p�t|���||��}|tur|S|p||kS)zJReturn a <= b.  Computed by @total_ordering from (not a >= b) or (a == b).�r.�__ge__r0r1s   r(�_le_from_gerR�rAr+c�n�t|���||��}|tur|S|o||kS)zFReturn a > b.  Computed by @total_ordering from (a >= b) and (a != b).rPr1s   r(�_gt_from_gerT�rDr+c�d�t|���||��}|tur|S|S)z=Return a < b.  Computed by @total_ordering from (not a >= b).rPr1s   r(�_lt_from_gerV�r<r+rIr?rQr/)r/r?rIrQc�����fd�tD��}|std���t|��}t|D]!\}}||vr||_t	�||���"�S)z6Class decorator that fills in missing ordering methodsc�b��h|]+}t�|d��tt|d��u�)|��,S�N)r�object)�.0�op�clss  �r(�	<setcomp>z!total_ordering.<locals>.<setcomp>�s=���^�^�^�B�g�c�2�t�&<�&<�G�F�TV�X\�D]�D]�&]�&]�R�&]�&]�&]r+z6must define at least one ordering operation: < > <= >=)�_convert�
ValueError�maxrr)r]�roots�root�opname�opfuncs`    r(rr�s����
_�^�^�^�(�^�^�^�E��S��Q�R�R�R��u�:�:�D�"�4�.�)�)��������$�F�O��C���(�(�(���Jr+c�2��G�fd�dt��}|S)z,Convert a cmp= function into a key= functionc�R��eZdZdgZd�Z�fd�Z�fd�Z�fd�Z�fd�Z�fd�Z	dZ
dS)	�cmp_to_key.<locals>.K�objc��||_dSrY�ri)r2ris  r(�__init__zcmp_to_key.<locals>.K.__init__�s
���D�H�H�Hr+c�8���|j|j��dkS�Nrrk�r2r3�mycmps  �r(r/zcmp_to_key.<locals>.K.__lt__������5���5�9�-�-��1�1r+c�8���|j|j��dkSrnrkros  �r(rIzcmp_to_key.<locals>.K.__gt__�rqr+c�8���|j|j��dkSrnrkros  �r(�__eq__zcmp_to_key.<locals>.K.__eq__������5���5�9�-�-��2�2r+c�8���|j|j��dkSrnrkros  �r(r?zcmp_to_key.<locals>.K.__le__�rur+c�8���|j|j��dkSrnrkros  �r(rQzcmp_to_key.<locals>.K.__ge__�rur+N)rrr�	__slots__rlr/rIrtr?rQ�__hash__)rps�r(�Krh�s���������G�	�	�	�	�	2�	2�	2�	2�	2�	2�	2�	2�	2�	2�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����r+rz)rZ)rprzs` r(rr�s>����������F����
�Hr+)rc��t|��}|tur/	t|��}n #t$rt	d��d�wxYw|}|D]}|||��}�|S)a�
    reduce(function, iterable[, initial]) -> value

    Apply a function of two arguments cumulatively to the items of a sequence
    or iterable, from left to right, so as to reduce the iterable to a single
    value.  For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates
    ((((1+2)+3)+4)+5).  If initial is present, it is placed before the items
    of the iterable in the calculation, and serves as a default when the
    iterable is empty.
    z0reduce() of empty iterable with no initial valueN)�iter�_initial_missing�next�
StopIteration�	TypeError)�function�sequence�initial�itr'�elements      r(r
r
�s���
�h���B��"�"�"�	N���H�H�E�E���	N�	N�	N��B�D�D�IM�
N�	N�������)�)������(�(����Ls	�*�A)r
c�^��eZdZdZdZ�fd�Zd�Ze��d���Zd�Z	d�Z
�xZS)rzSNew function with partial application of the given arguments
    and keywords.
    )�func�args�keywordsr�__weakref__c���t|��std���t|d��r|j|z}i|j�|�}|j}t
t|���|��}||_||_||_|S)Nz#the first argument must be callabler�)	�callabler��hasattrr�r�r��superr�__new__)r]r�r�r�r2�	__class__s     �r(r�zpartial.__new__s������~�~�	C��A�B�B�B��4�� � �	��9�t�#�D�4�$�-�4�8�4�H��9�D��W�c�"�"�*�*�3�/�/����	���	� ��
��r+c�F�i|j�|�}|jg|j�|�Ri|��SrY�r�r�r�)r2r�r�s   r(�__call__zpartial.__call__+s:��0�d�m�0�x�0���t�y�7�$�)�7�d�7�7�7�h�7�7�7r+c��t|��j}t|j��g}|�d�|jD����|�d�|j���D����t|��jdkrd|�dd�	|���d�S|�dd�	|���d�S)Nc3�4K�|]}t|��V��dSrY)�repr)r[�xs  r(�	<genexpr>z#partial.__repr__.<locals>.<genexpr>3s(����/�/��D��G�G�/�/�/�/�/�/r+c3�*K�|]\}}|�d|��V��dS)�=N��r[�k�vs   r(r�z#partial.__repr__.<locals>.<genexpr>4s0����E�E�V�a��q�L�L�1�L�L�E�E�E�E�E�Er+�	functoolsz
functools.�(�, �))
r.rr�r��extendr�r��itemsr�join)r2�qualnamer�s   r(�__repr__zpartial.__repr__/s�����:�:�*���T�Y��� �����/�/�T�Y�/�/�/�/�/�/����E�E�t�}�/B�/B�/D�/D�E�E�E�E�E�E���:�:� �K�/�/�=��=�=�4�9�9�T�?�?�=�=�=�=��/�/�T�Y�Y�t�_�_�/�/�/�/r+c�j�t|��|jf|j|j|jpd|jpdffSrY)r.r�r�r�r�r2s r(�
__reduce__zpartial.__reduce__9s;���D�z�z�D�I�<�$�)�T�Y��}�$��d�m�&;�t�*=�=�	=r+c�4�t|t��std���t|��dkrtdt|�������|\}}}}t	|��rCt|t��r.|�t|t
��r|�$t|t
��std���t|��}|�i}n%t
|��t
urt|��}|�i}||_||_||_	||_
dS)Nz(argument to __setstate__ must be a tuple�zexpected 4 items in state, got zinvalid partial state)�
isinstance�tupler��lenr��dictr.rr�r�r�)r2�stater�r��kwds�	namespaces      r(�__setstate__zpartial.__setstate__=s���%��'�'�	H��F�G�G�G��u�:�:��?�?��J�c�%�j�j�J�J�K�K�K�&+�#��d�D�)�����	5�j��u�&=�&=�	5���Z��d�%;�%;���!�*�Y��*E�*E�!��3�4�4�4��T�{�{���<��D�D�
�$�Z�Z�t�
#�
#���:�:�D����I�!��
���	���	���
�
�
r+)rrrrrxr�r�rr�r�r��
__classcell__)r�s@r(rrs����������F�I������ 8�8�8��^���0�0���0�=�=�=�������r+r)rc�X�eZdZdZd�Zd�Zd�Zdd�Zed���Z	e
e��ZdS)	rz�Method descriptor with partial application of the given arguments
    and keywords.

    Supports wrapping existing descriptors and handles non-descriptor
    callables as instance methods.
    c�6�t|��s2t|d��s"td�|�����t	|t
��r-|j|_|j|z|_i|j�|�|_dS||_||_||_dS)N�__get__z${!r} is not callable or a descriptor)	r�r�r��formatr�rr�r�r�)r2r�r�r�s    r(rlzpartialmethod.__init__cs�����~�~�	0�g�d�I�&>�&>�	0��B�"(�&��,�,�0�0�
0�
�d�M�*�*�
	%��	�D�I��	�D�(�D�I�9�t�}�9��9�D�M�M�M��D�I��D�I�$�D�M�M�Mr+c�2�d�tt|j����}d�d�|j���D����}d}|�|jj|jj	|j
||���S)Nr�c3�HK�|]\}}d�||��V��dS)z{}={!r}N)r�r�s   r(r�z)partialmethod.__repr__.<locals>.<genexpr>xsR����D�D�%)�Q��'�-�-�a��3�3�D�D�D�D�D�Dr+z*{module}.{cls}({func}, {args}, {keywords}))�moduler]r�r�r�)r��mapr�r�r�r�r�r�rrr�)r2r�r��
format_strings    r(r�zpartialmethod.__repr__vs����y�y��T�4�9�-�-�.�.���9�9�D�D�-1�]�-@�-@�-B�-B�D�D�D�D�D��D�
��#�#�4�>�+D�(,��(C�)-��)-�-5�	$�7�7�	7r+c�8���fd�}�j|_�|_|S)Nc�J��i�j�|�}�j|g�j�|�Ri|��SrYr�)�cls_or_selfr�r�r2s   �r(�_methodz3partialmethod._make_unbound_method.<locals>._method�s=���4�$�-�4�8�4�H��4�9�[�H�4�9�H�t�H�H�H�x�H�H�Hr+)�__isabstractmethod__�_partialmethod)r2r�s` r(�_make_unbound_methodz"partialmethod._make_unbound_method�s;���	I�	I�	I�	I�	I�(,�'@��$�!%����r+Nc�(�t|jdd��}d}|�M|||��}||jur8t|g|j�Ri|j��}	|j|_n#t$rYnwxYw|�(|����||��}|S)Nr�)	rr�rr�r��__self__rr�r�)r2rir]�get�result�new_funcs      r(r�zpartialmethod.__get__�s����d�i��D�1�1�����?��s�3��}�}�H��t�y�(�(�!��G�D�I�G�G�G���G�G���&.�&7�F�O�O��%�����D������>��.�.�0�0�8�8��c�B�B�F��
s�A�
A%�$A%c�.�t|jdd��S�Nr�F�rr�r�s r(r�z"partialmethod.__isabstractmethod__�����t�y�"8�%�@�@�@r+rY)
rrrrrlr�r�r��propertyr��classmethodr�__class_getitem__r�r+r(rr[s���������%�%�%�&	7�	7�	7��������&�A�A��X�A�$��L�1�1���r+rc�h�t|t��r|j}t|t���|SrY)r�rr��r�s r(�_unwrap_partialr��s4��
�T�7�
#�
#���y���T�7�
#�
#���Kr+�	CacheInfo)�hits�misses�maxsize�currsizec�&�eZdZdZdZefd�Zd�ZdS)�
_HashedSeqz� This class guarantees that hash() will be called no more than once
        per element.  This is important because the lru_cache() will hash
        the key multiple times on a cache miss.

    �	hashvaluec�4�||dd�<||��|_dSrY�r�)r2�tup�hashs   r(rlz_HashedSeq.__init__�s"����Q�Q�Q����c������r+c��|jSrYr�r�s r(ryz_HashedSeq.__hash__�s
���~�r+N)rrrrrxr�rlryr�r+r(r�r��sK���������I�!%�#�#�#�#�����r+r�c�V��|}|r!||z
}|���D]}	||	z
}�|rI||�fd�|D����z
}|r,||�fd�|���D����z
}n*||��dkr�|d��|vr|dSt|��S)a�Make a cache key from optionally typed positional and keyword arguments

    The key is constructed in a way that is flat as possible rather than
    as a nested structure that would take more memory.

    If there is only a single argument and its data type is known to cache
    its hash value, then that argument is returned without a wrapper.  This
    saves space and improves lookup speed.

    c3�.�K�|]}�|��V��dSrYr��r[r�r.s  �r(r�z_make_key.<locals>.<genexpr>�s+�����+�+��T�T�!�W�W�+�+�+�+�+�+r+c3�.�K�|]}�|��V��dSrYr�r�s  �r(r�z_make_key.<locals>.<genexpr>�s+�����8�8�Q���a���8�8�8�8�8�8r+�r)r��valuesr�)
r�r��typed�kwd_mark�	fasttypesr�r.r��key�items
      `   r(�	_make_keyr��s����$�C����x����J�J�L�L�	�	�D��4�K�C�C����u�u�+�+�+�+�d�+�+�+�+�+�+���	9��5�5�8�8�8�8�$�+�+�-�-�8�8�8�8�8�8�C��	��S���Q���4�4��A��<�<�9�4�4��1�v�
��c�?�?�r+�Fc�*���t�t��r	�dkrd�nlt���rLt�t��r7�dc}�t	|��t
��}��fd�|_t||��S��td�����fd�}|S)a�Least-recently-used cache decorator.

    If *maxsize* is set to None, the LRU features are disabled and the cache
    can grow without bound.

    If *typed* is True, arguments of different types will be cached separately.
    For example, f(3.0) and f(3) will be treated as distinct calls with
    distinct results.

    Arguments to the cached function must be hashable.

    View the cache statistics named tuple (hits, misses, maxsize, currsize)
    with f.cache_info().  Clear the cache and statistics with f.cache_clear().
    Access the underlying function with f.__wrapped__.

    See:  https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)

    rr�c�����d�S�N�r�r�r�r�s��r(�<lambda>zlru_cache.<locals>.<lambda>�����%�,P�,P�r+Nz=Expected first argument to be an integer, a callable, or Nonec�h��t|��t��}��fd�|_t||��S)Nc�����d�Sr�r�r�s��r(r�z8lru_cache.<locals>.decorating_function.<locals>.<lambda>r�r+)�_lru_cache_wrapper�
_CacheInfo�cache_parametersr)�
user_functionr"r�r�s  ��r(�decorating_functionz&lru_cache.<locals>.decorating_functions:���$�]�G�U�J�O�O��#P�#P�#P�#P�#P�� ��g�}�5�5�5r+)	r��intr��boolr�r�r�rr�)r�r�r�r"r�s``   r(r	r	�s�����2�'�3���M��Q�;�;��G��	�'�	�	�M�z�%��6�6�M�!(�#��
�w�$�]�G�U�J�O�O��#P�#P�#P�#P�#P�� ��g�}�5�5�5�	�	��K�M�M�	M�6�6�6�6�6�6�
�r+c�h�������	�
���
��������t���t�d\�	���
i�dx��d��j��j�
t	���g���ddg�dd�<�dkr��fd�}n#��
��������fd�}n���	�
���
���������fd�}��
����fd�}������fd�}||_||_|S)	N)rr���rFc�"���dz
��|i|��}|S�Nr�r�)r�r�r�r�r�s   ��r(r"z#_lru_cache_wrapper.<locals>.wrappers'���
�a�K�F�"�]�D�1�D�1�1�F��Mr+c�t���||�
��}�|�	��}|�	ur�dz
�|S�dz
��|i|��}|�|<|Srr�)r�r�r�r�r�	cache_getr��make_keyr��sentinelr�r�s    ��������r(r"z#_lru_cache_wrapper.<locals>.wrapper'sm����(�4��u�-�-�C��Y�s�H�-�-�F��X�%�%���	���
��a�K�F�"�]�D�1�D�1�1�F��E�#�J��Mr+c����||���}�5�|��}|�@|\}}}}||�
<||�<��}|x|�
<��<||�<�|�
<�dz
�|cddd��S�dz
�ddd��n#1swxYwY�|i|��}�5|�vrnd�r7�}	||	�<||	�<|	�
���}
��}dx��<��<�|
=|	�|<n+��}|�||g}|x|�
<x��<�|<����k�ddd��n#1swxYwY|Srr�)r�r�r��link�	link_prev�	link_next�_keyr��last�oldroot�oldkey�	oldresult�KEY�NEXT�PREV�RESULTrr�	cache_len�fullr��lockrr�r�rcr�r�s            ����������������r(r"z#_lru_cache_wrapper.<locals>.wrapper6sB����(�4��u�-�-�C��

�

� �y��~�~���#�9=�6�I�y�$��&/�I�d�O�&/�I�d�O���:�D�.2�2�D��J��d��!%�D��J�!%�D��J��A�I�D�!�

�

�

�

�

�

�

�

��!���

�

�

�

�

�

�

�

�

�

�

����

�

�

�

�#�]�D�1�D�1�1�F��#
4�#
4��%�<�<�
��4�"�G�#&�G�C�L�&,�G�F�O�#�4�=�D�!�#�Y�F� $�V��I�/3�3�D��I��V���f�
�")�E�#�J�J� ��:�D� �$��V�4�D�;?�?�D��J�?��d��e�C�j�&�I�K�K�7�2�D�G#
4�#
4�#
4�#
4�#
4�#
4�#
4�#
4�#
4�#
4�#
4����#
4�#
4�#
4�#
4�H�Ms+�AA0�A0�0A4�7A4�A*C;�;C?�C?c�h���5���������cddd��S#1swxYwYdS)zReport cache statisticsNr�)r�rr�rr�r�s������r(�
cache_infoz&_lru_cache_wrapper.<locals>.cache_infoos����
�	B�	B��:�d�F�G�Y�Y�[�[�A�A�	B�	B�	B�	B�	B�	B�	B�	B�	B�	B�	B�	B����	B�	B�	B�	B�	B�	Bs�'�+�+c����5������ddg�dd�<dx��d�ddd��dS#1swxYwYdS)z$Clear the cache and cache statisticsNrF)�clear)rrr�rr�rcs������r(�cache_clearz'_lru_cache_wrapper.<locals>.cache_clearts�����	�	��K�K�M�M�M��T�4��.�D����G���D�6��D�		�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�&7�;�;)rZr�r��__len__rrr)r�r�r�r�r"rrrrrrrrrrr�rrr�rcrs````   @@@@@@@@@@@@@@r(r�r�
s����������������������x�x�H��H�(��D�$��V��E���D�6��D��	�I��
�I��7�7�D�
�D��T�4��&�D����G��!�|�|�	�	�	�	�	�	�	�
��	�	�	�	�	�	�	�	�	�	�	�	�	�7	�7	�7	�7	�7	�7	�7	�7	�7	�7	�7	�7	�7	�7	�7	�7	�7	�7	�7	�7	�rB�B�B�B�B�B�B�B�B�B�
����������$�G��%�G���Nr+)r�c�4�td���|��S)z@Simple lightweight unbounded cache.  Sometimes called "memoize".N)r�)r	)r�s r(rr�s��"�9�T�"�"�"�=�1�1�1r+c���g}	d�|D��}|s|S|D]!}|d}|D]}||dd�vrd}n�n�"|�td���|�|��|D]}|d|kr|d=��o)z�Merges MROs in *sequences* to a single MRO using the C3 algorithm.

    Adapted from https://www.python.org/download/releases/2.3/mro/.

    Tc��g|]}|�|��Sr�r�)r[�ss  r(�
<listcomp>z_c3_merge.<locals>.<listcomp>�s��/�/�/�1�Q�/�Q�/�/�/r+rr�NzInconsistent hierarchy)�RuntimeError�append)�	sequencesr��s1�	candidate�s2�seqs      r(�	_c3_merger)�s����F��/�/�	�/�/�/�	��	��M��	�	�B��1��I��
�
����1�2�2��&�&� $�I��E�'�������7�8�8�8��
�
�i� � � ��	�	�C��1�v��"�"���F��%r+Nc���
�tt|j����D].\}�
t�
d��rt	|j��|z
}n�/d}�rt���ng�t|jd|���}g}t|j|d���}�D]G�
t
|�
��r5t�
fd�|jD����s|��
���H|D]�
��	�
����fd�|D��}�fd�|D��}�fd�|D��}	t|gg|z|z|	z|gz|gz|gz��S)a�Computes the method resolution order using extended C3 linearization.

    If no *abcs* are given, the algorithm works exactly like the built-in C3
    linearization used for method resolution.

    If given, *abcs* is a list of abstract base classes that should be inserted
    into the resulting MRO. Unrelated ABCs are ignored and don't end up in the
    result. The algorithm inserts ABCs where their functionality is introduced,
    i.e. issubclass(cls, abc) returns True for the class itself but returns
    False for all its direct base classes. Implicit ABCs for a given class
    (either registered or inferred from the presence of a special method like
    __len__) are inserted directly after the last ABC explicitly listed in the
    MRO of said class. If two implicit ABCs end up next to each other in the
    resulting MRO, their ordering depends on the order of types in *abcs*.

    �__abstractmethods__rNc3�8�K�|]}t|���V��dSrY)�
issubclass)r[�b�bases  �r(r�z_c3_mro.<locals>.<genexpr>�s>�����-�-�()�
�1�d�#�#�-�-�-�-�-�-r+c�2��g|]}t|������S���abcs��_c3_mro�r[r/r3s  �r(r!z_c3_mro.<locals>.<listcomp>��&���L�L�L�T���4�0�0�0�L�L�Lr+c�2��g|]}t|������Sr1r4r6s  �r(r!z_c3_mro.<locals>.<listcomp>�r7r+c�2��g|]}t|������Sr1r4r6s  �r(r!z_c3_mro.<locals>.<listcomp>�s&���F�F�F�$�W�T��-�-�-�F�F�Fr+)�	enumerate�reversed�	__bases__r�r��listr-�anyr#�remover))r]r3�i�boundary�explicit_bases�abstract_bases�other_bases�explicit_c3_mros�abstract_c3_mros�
other_c3_mrosr/s `        @r(r5r5�s�����"�X�c�m�4�4�5�5�����4��4�.�/�/�	��3�=�)�)�A�-�H��E�	����%�4��:�:�:�2�D��#�-�	��	�2�3�3�N��N��s�}�X�Y�Y�/�0�0�K��(�(���c�4� � �	(��-�-�-�-�-0�]�-�-�-�*�*�	(�

�!�!�$�'�'�'���������D�����L�L�L�L�^�L�L�L��L�L�L�L�^�L�L�L��F�F�F�F�+�F�F�F�M��

����	�+�	,�.;�	<�	��	�*�+�	,�/:�m�	<���r+c�&�����	�
�t�j�����fd���fd��D����fd��	�	fd��D���t����
g}�D]�}g}|���D]<}|�vr6t�|��r&|��
fd�|jD�����=|s|�|���m|�td���|D] }|D]}||vr|�|����!��t�|���S)	z�Calculates the method resolution order for a given class *cls*.

    Includes relevant abstract base classes (with their respective bases) from
    the *types* iterable. Uses a modified C3 linearization algorithm.

    c�x��|�vo5t|d��o%t|t��ot�|��S)N�__mro__)r�r�rr-)�typ�basesr]s ��r(�
is_relatedz _compose_mro.<locals>.is_related�sH����5� �:�W�S�)�%<�%<�:�)3�C��)F�)F�%F�:�%/��S�%9�%9�	;r+c�*��g|]}�|���
|��Sr�r�)r[�nrMs  �r(r!z _compose_mro.<locals>.<listcomp>�s&���/�/�/�1���A���/�Q�/�/�/r+c�6���D]}||kr||jvrdS�dS)NTF)rJ)rKr3�typess  �r(�is_strict_basez$_compose_mro.<locals>.is_strict_base�s4����	�	�E��e�|�|��u�}� 4� 4��t�t���ur+c�*��g|]}�|���
|��Sr�r�)r[rOrRs  �r(r!z _compose_mro.<locals>.<listcomp>�s(���7�7�7�1�^�^�A�%6�%6�7�Q�7�7�7r+c���g|]}|�v�|��	Sr�r�)r[r �type_sets  �r(r!z _compose_mro.<locals>.<listcomp>�s���F�F�F�A��X�
�
�a�
�
�
r+T)r��reverser2)�setrJ�__subclasses__r-r#�sortr�r5)r]rQ�mrorK�found�sub�subclsrLrMrRrUs``     @@@@r(�_compose_mror^�s���������
�����E�;�;�;�;�;�;�
0�/�/�/��/�/�/�E������

8�7�7�7��7�7�7�E��5�z�z�H�
�C��
'�
'�����%�%�'�'�	H�	H�C��%���J�s�C�$8�$8�����F�F�F�F���F�F�F�G�G�G���	��J�J�s�O�O�O��
�
�
�s�D�
�)�)�)��	'�	'�C��
'�
'����$�$��J�J�v�&�&�&��
'�	'��3�S�!�!�!�!r+c�$�t||�����}d}|D]U}|�K||vrE||jvr<||jvr3t||��s#t	d�||�����n||vr|}�V|�|��S)a^Returns the best matching implementation from *registry* for type *cls*.

    Where there is no registered implementation for a specific type, its method
    resolution order is used to find a more generic implementation.

    Note: if *registry* does not contain an implementation for the base
    *object* type, this function may return None.

    NzAmbiguous dispatch: {} or {})r^�keysrJr-r"r�r�)r]�registryrZ�match�ts     r(�
_find_implrds����s�H�M�M�O�O�
,�
,�C��E�
�������X�
�
�!�3�;�"6�"6�"'�s�{�":�":�&0���&:�&:�#;�"�#A�#H�#H��1�$�$�����E���=�=��E���<�<����r+c�Z�������	�
��ddl�ddl}i�
|����d����
fd���fd���fd��d
�����	�
fd�	�	��fd�}t|dd	���|�
t<�	|_�|_���
��|_�j	|_
t||��|S)akSingle-dispatch generic function decorator.

    Transforms a function into a generic function, which can have different
    behaviours depending upon the type of its first argument. The decorated
    function acts as the default implementation, and additional
    implementations can be registered using the register() attribute of the
    generic function.
    rNc������*t��}�|kr����|�	�|}n?#t$r2	�|}n #t$rt|���}YnwxYw|�|<YnwxYw|S)z�generic_func.dispatch(cls) -> <function implementation>

        Runs the dispatch algorithm to return the best available implementation
        for the given *cls* registered on *generic_func*.

        )rr�KeyErrorrd)r]�
current_token�impl�cache_token�dispatch_cacheras   ���r(�dispatchz singledispatch.<locals>.dispatch2s�����"�+�-�-�M��m�+�+��$�$�&�&�&�+��	'�!�#�&�D�D���	'�	'�	'�
1���}�����
1�
1�
1�!�#�x�0�0����
1����"&�N�3����	'�����s3�8�
A4�A�A4�A)�&A4�(A)�)A4�3A4c�<��ddlm}m}||��|�jhvS)Nr)�
get_origin�Union)�typingrnro�	UnionType)r]rnrorQs   �r(�_is_union_typez&singledispatch.<locals>._is_union_typeIs5���,�,�,�,�,�,�,�,��z�#���5�%�/�":�:�:r+c���t|t��rdSddlm}�|��o!t	d�||��D����S)NTr��get_argsc3�@K�|]}t|t��V��dSrY)r�r.)r[�args  r(r�zBsingledispatch.<locals>._is_valid_dispatch_type.<locals>.<genexpr>Rs,����C�C�c�J�s�D�)�)�C�C�C�C�C�Cr+)r�r.rpru�all)r]rurrs  �r(�_is_valid_dispatch_typez/singledispatch.<locals>._is_valid_dispatch_typeMsg����c�4� � �	��4�#�#�#�#�#�#���s�#�#�D��C�C�X�X�c�]�]�C�C�C�C�C�	Er+c�l�������r	|���fd�Sn�|�td��d����t�di��}|std��d�����}dd	lm}t	t||���������\}�����s7����rtd
|�d��d����td
|�d��d
��������rddlm}|���D]}|�|<�n|��<�	�t�d��rt���	�
�
��|S)z�generic_func.register(cls, func) -> func

        Registers a new implementation for the given *cls* on a *generic_func*.

        Nc�����|��SrYr�)�fr]�registers ��r(r�z2singledispatch.<locals>.register.<locals>.<lambda>]s�����#�q�!1�!1�r+z(Invalid first argument to `register()`. z is not a class or union type.rz(Invalid first argument to `register()`: zS. Use either `@register(some_class)` or plain `@register` on an annotated function.r)�get_type_hintszInvalid annotation for z. z not all arguments are classes.z is not a class.rtr+)r�rrpr~r~r|r�rur�rr)
r]r��annr~�argnamerurwrrryrjrkr}ras
`      ������r(r}z singledispatch.<locals>.registerTs����#�"�3�'�'�	��|�1�1�1�1�1�1�����=��=�=�=�����#�0�"�5�5�C��
��1�s�1�1�1����
�D�
.�-�-�-�-�-���^�^�D�%9�%9�%?�%?�%A�%A� B� B�C�C�L�G�S�*�*�3�/�/�

�!�>�#�&�&�	�#�B�'�B�B��B�B�B����
$�3�'�3�3��3�3�3����
�>�#���	!�'�'�'�'�'�'��x��}�}�
%�
%�� $���
�
�
%�!�H�S�M���7�3�0E�#F�#F��)�+�+�K��������r+c�d��|st��d�����|dj��|i|��S)Nz( requires at least 1 positional argumentr)r�r�)r��kwrl�funcnames  ��r(r"zsingledispatch.<locals>.wrapper�sV����	5��x�4�4�4�5�5�
5�+�x�x��Q��)�*�*�D�7�B�7�7�7r+rzsingledispatch functionrY)rQ�weakref�WeakKeyDictionaryrrZr}rl�MappingProxyTyperar�_clear_cacher)r�r�r"rrryrjrlrkr�r}rarQs   @@@@@@@@@r(r
r
 sT��������������������H��.�.�0�0�N��K��������.;�;�;�;�;�E�E�E�E�E�2�2�2�2�2�2�2�2�2�2�2�h8�8�8�8�8�8��t�Z�)B�C�C�H��H�V���G���G���-�-�h�7�7�G��)�/�G���7�D�!�!�!��Nr+c�>�eZdZdZd�Zdd�Zdd�Zed���ZdS)rz�Single-dispatch generic method descriptor.

    Supports wrapping existing descriptors and handles non-descriptor
    callables as instance methods.
    c��t|��s"t|d��st|�d����t|��|_||_dS)Nr�z  is not callable or a descriptor)r�r�r�r
�
dispatcherr��r2r�s  r(rlzsingledispatchmethod.__init__�sT����~�~�	I�g�d�I�&>�&>�	I��t�G�G�G�H�H�H�(��.�.�����	�	�	r+Nc�:�|j�||���S)z�generic_method.register(cls, func) -> func

        Registers a new implementation for the given *cls* on a *generic_method*.
        r�)r�r})r2r]�methods   r(r}zsingledispatchmethod.register�s��
��'�'��&�'�9�9�9r+c�t�������fd�}�j|_�j|_t|�j��|S)Nc����j�|dj��}|�����|i|��Srn)r�rlr�r�)r��kwargsr�r]rir2s   ���r(r�z-singledispatchmethod.__get__.<locals>._method�sB����_�-�-�d�1�g�.?�@�@�F�+�6�>�>�#�s�+�+�T�<�V�<�<�<r+)r�r}rr�)r2rir]r�s``` r(r�zsingledispatchmethod.__get__�sV�����	=�	=�	=�	=�	=�	=�	=�(,�'@��$��=����w��	�*�*�*��r+c�.�t|jdd��Sr�r�r�s r(r�z)singledispatchmethod.__isabstractmethod__�r�r+rY)	rrrrrlr}r�r�r�r�r+r(rr�su�����������:�:�:�:������A�A��X�A�A�Ar+rc�8�eZdZd�Zd�Zdd�Zee��ZdS)rc�`�||_d|_|j|_t��|_dSrY)r��attrnamerrrr�s  r(rlzcached_property.__init__�s(����	���
��|����G�G��	�	�	r+c�r�|j�	||_dS||jkrtd|j�d|�d����dS)Nz?Cannot assign the same cached_property to two different names (z and z).)r�r�)r2�owner�names   r(�__set_name__zcached_property.__set_name__�sb���=� � �D�M�M�M�
�T�]�
"�
"��5��M�5�5�*.�5�5�5���
�#�
"r+Nc�h�|�|S|j�td���	|j}n>#t$r1dt	|��j�d|j�d�}t|��d�wxYw|�|jt��}|tur�|j5|�|jt��}|tur_|�	|��}	|||j<n>#t$r1dt	|��j�d|j�d�}t|��d�wxYwddd��n#1swxYwY|S)NzGCannot use cached_property instance without calling __set_name__ on it.zNo '__dict__' attribute on z instance to cache z
 property.zThe '__dict__' attribute on z7 instance does not support item assignment for caching )
r�r�rrr.rr��
_NOT_FOUNDrr�)r2�instancer�r�msg�vals      r(r�zcached_property.__get__�s������K��=� ��Y�[�[�
[�	+��%�E�E���	+�	+�	+�A�d�8�n�n�.E�A�A�%)�]�A�A�A�
��C�.�.�d�*�	+�����i�i��
�z�2�2���*�����
7�
7��i�i��
�z�:�:���*�$�$��)�)�H�-�-�C�7�/2��d�m�,�,��$�7�7�7�h�4��>�>�;R�h�h�LP�M�h�h�h��(��n�n�$�6�7����
7�
7�
7�
7�
7�
7�
7�
7�
7�
7�
7����
7�
7�
7�
7��
s3�$�;A�?D'�
C�D'�;D�D'�'D+�.D+rY)	rrrrlr�r�r�rr�r�r+r(rr�sT����������������>$��L�1�1���r+r)r�FrY);r�__all__�abcr�collectionsr�reprlibr�_threadrrQrrrrrr5r8r;r@rCrFrJrLrNrRrTrVr_rr�
_functools�ImportErrorrZr}r
rrr�r�r=r�r��strr�r.r�r�r	r�rr)r5r^rdr
rr�rr�r+r(�<module>r�s��������
 ������"�"�"�"�"�"�"�"�"�"�"�"�������������*����2�,�����>)�#�7�7�7�7�0+�+�+�&�&�&����*�*�*�'�'�'����+�+�+�&�&�&����*�*�*�'�'�'�����+�&��+�&��+�&�(��+�&��+�&��+�&�(��+�&��+�&��+�&�(��+�&��+�&��+�&�(�
�
�����$
�
�
�&	�%�%�%�%�%�%�%���	�	�	��D�	�����6�8�8��'7�����8	�!�!�!�!�!�!�!���	�	�	��D�	����?�?�?�?�?�?�?�?�B	�"�"�"�"�"�"�"���	�	�	��D�	����E2�E2�E2�E2�E2�F�E2�E2�E2�T����Z��%N�%N�%N�
O�
O�
����������" ������s���t������>,�,�,�,�\r�r�r�h	�-�-�-�-�-�-�-���	�	�	��D�	����2�2�2����6+�+�+�+�Z("�("�("�T���4v�v�v�t!A�!A�!A�!A�!A�!A�!A�!A�P�V�X�X�
�/2�/2�/2�/2�/2�/2�/2�/2�/2�/2sH�B�B�B�-B4�4B<�;B<�
C�C�C�(D/�/D7�6D7

ZeroDay Forums Mini