Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/util/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/util/__pycache__/langhelpers.cpython-311.pyc

�

�܋f[����dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZddlmZd	�ZGd
�de��Zd�Zd
�Zd�Zd�Zd�Zd�ZdZd�ZGd�de��Zd�ZdZd�Zd�Zd[d�Zd\d�Zd\d�Z d�Z!d�Z"d]d �Z#Gd!�d"e��Z$d#�Z%d$�Z&				d^d&�Z'd'�Z(d_d(�Z)Gd)�d*e��Z*d+�Z+Gd,�d-e��Z,Gd.�d/e��Z-d`d0�Z.d1�Z/d2�Z0d3�Z1dad4�Z2d5�Z3d6�Z4dZd7�Z5d8�Z6d9�Z7Gd:�d;e8��Z9Gd<�d=e��Z:Gd>�d?e��Z;Gd@�dAe<��Z=dBe=_>GdC�dBe��Z?da@dD�ZAdE�ZBdbdG�ZCGdH�dIejD��ZEdJ�ZFdK�ZGdL�ZHejIdM��ZJejIdN��ZKeKeJfdO�ZLeMd��ZNdP�ZOGdQ�dReM��ZPdS�ZQdT�ZRdU�ZSdV�ZTdW�ZUdX�ZVdY�ZWdS)cz�Routines to help with the creation, loading and introspection of
modules, classes, hierarchies, attributes, functions, and methods.

���update_wrapperN�)�_collections)�compat�)�excc��tjr|�d��}tj��}|�|��|���S)Nzutf-8)r�py3k�encode�hashlib�md5�update�	hexdigest)�x�ms  �R/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/util/langhelpers.py�md5_hexrsE��
�{��
�H�H�W������
�
�A��H�H�Q�K�K�K��;�;�=�=��c�*�eZdZdZdZdd�Zd�Zd�ZdS)	�safe_reraiseaKReraise an exception after invoking some
    handler code.

    Stores the existing exception info before
    invoking so that it is maintained across a potential
    coroutine context switch.

    e.g.::

        try:
            sess.commit()
        except:
            with safe_reraise():
                sess.rollback()

    )�	warn_only�	_exc_infoFc��||_dS�N)r)�selfrs  r�__init__zsafe_reraise.__init__8s
��"����rc�6�tj��|_dSr)�sys�exc_infor�rs r�	__enter__zsafe_reraise.__enter__;s���������rc�B�|�3|j\}}}d|_|jstj||���dSdStjs@|jr9|jdr,td|jd�d|jd�d���d|_tj||���dS)N)�with_tracebackrz`An exception has occurred during handling of a previous exception.  The previous exception is:
 r� �
)rrr�raise_r�warn)r�type_�value�	traceback�exc_type�	exc_value�exc_tbs       r�__exit__zsafe_reraise.__exit__>s����=�*.�.�'�H�i��!�D�N��>�
��
��#)�������
�
��;�
�4�>�
�d�n�Q�6G�
���(,�~�a�'8�'8�'8�$�.��:K�:K�:K�M����
"�D�N��M�%�	�:�:�:�:�:�:rN�F)�__name__�
__module__�__qualname__�__doc__�	__slots__rr"r/�rrrr$sW��������"+�I�#�#�#�#�(�(�(�;�;�;�;�;rrc�p�d�d�tjd|j��D����S)Nr%c3�>K�|]}|���V��dSr)�lower)�.0�ns  r�	<genexpr>z(clsname_as_plain_name.<locals>.<genexpr>Vs;����������	�	������rz
([A-Z][a-z]+))�join�re�findallr1)�clss r�clsname_as_plain_namerAUsC���8�8����:�&6���E�E������rc���g}|j|j|jfD];}t|d��r|���}|�|���<t
|��S)zrdecode a slice object as sent to __getitem__.

    takes into account the 2.5 __index__() method, basically.

    �	__index__)�start�stop�step�hasattrrC�append�tuple)�slc�retrs   r�decode_slicerL[sa��
�C�
�Y���#�(�
*�����1�k�"�"�	����
�
�A��
�
�1�
�
�
�
���:�:�rc
'��K�t|��}|D]q�tj�ftj�fd�td������}|D]!}||vr|�|��|V�n�"td�z����rdS)Nc�(���t|��zSr)�str)�i�bases �r�<lambda>z!_unique_symbols.<locals>.<lambda>ns���D�3�q�6�6�M�ri�z&exhausted namespace for symbol base %s)�set�	itertools�chainr�itertools_imap�range�add�	NameError)�used�bases�pool�symrQs    @r�_unique_symbolsr^is�������t�9�9�D��M�M����
�G��!�"9�"9�"9�"9�5��;�;�G�G�
�
���	M�	M�C��$�������
�
�
��	�	�	����
�D�t�K�L�L�L��M�Mrc#�LK�|r||dzz}||��V�||z}|�dSdS)z6Call the given function given each nonzero bit from n.rNr6)�fnr;�bs   r�map_bitsrbysW������
�!��a��L���b��e�e����	�Q��������rc�.���fd�}t|���S)z'A signature-matching decorator factory.c�4��tj|��s#tj|��std���t	j|��}t
|d��|dd�z|jfz}t|dd��\}}t||���}|�
t|d�	����|j|d
<d|z}t||�||i|j��}t|d|��j|_||_t!||��S)
Nznot a decoratable functionrr��targetr`)rfr`F��grouped�namezDdef %(name)s(%(args)s):
    return %(target)s(%(fn)s, %(apply_kw)s)
�im_func)�inspect�
isfunction�ismethod�	Exceptionr�inspect_getfullargspecrIr1r^�dictr�format_argspec_plus�_exec_code_in_env�getattr�__defaults__�__wrapped__r)	r`�spec�names�	targ_name�fn_name�metadata�code�	decoratedrfs	        �r�decoratezdecorator.<locals>.decorate�s(����!�"�%�%�	:�g�.>�r�.B�.B�	:��8�9�9�9��,�R�0�0���d�1�g����a��c��*�b�k�^�;��,�U�H�d�C�C��	�7��y�W�5�5�5�����+�D�%�@�@�@�A�A�A��;����
��	
�	
�&��9�f�g�r�2�B�K�
�
�	�")��Y��!;�!;�!H�	�� "�	���i��,�,�,rr)rfr}s` r�	decoratorr~�s.���-�-�-�-�-�2�(�F�+�+�+rc�2�t||��||Sr)�exec)r{�envrys   rrrrr�s����s�O�O�O��w�<�rc
��t|t��r|j}|}d|r|n	d|jz�d|�d�}n	|x}}d|z}|�d��d}tj|��}|dd=t|d	�
��}||d<d|z}	|td
�}
t|	|
��|
|}t|d��rG|j\}}
|j}|�|j
�d|j��}t|d|
�d|�d|�d�d��}||_n|j|_d|�dd��dz|_
|j
t jvrt%d|j
�d����t
jst|d��r0||j_t|jd��s||f|j_n ||_t|d��s	||f|_|S)z�Produce a wrapping function for the given cls or classmethod.

    Rationale here is so that the __init__ method of the
    class can serve as documentation for the function.

    zConstruct a new :class:`z.%szX` object. 

This constructor is mirrored as a public API function; see :func:`sqlalchemyz,` for a full usage and argument description.zSThis function is mirrored; see :func:`sqlalchemy%s` for a description of arguments.�.���rFrgriz5def %(name)s(%(args)s):
    return cls(%(apply_kw)s)
)r@�symbol�
_linked_toNz[.. container:: inherited_member

    This documentation is inherited from :func:`sqlalchemyz&`; this constructor, :func:`sqlalchemyz!`,   creates a :class:`sqlalchemyzJ` object.  See that class for additional details describing this subclass.r�
sqlalchemyzpublic_factory location z is not in sys.modules�__func__)�
isinstance�typerr1�splitrrorqr�r�rGr�r4r2�inject_docstring_text�rsplitr�modules�ImportError�py2kr�)rf�location�class_locationr`�	callable_�doc�
location_namervrzr{r�r|�	linked_to�linked_to_location�
linked_to_docs               r�public_factoryr��sT���&�$���
�
�_���	�	�#1�M���e�f�o�6M�M�M����

�	�� ���Y�
.�08�
9�	�
�N�N�3�'�'��+�M��(��,�,�D��Q���
�"�4��7�7�7�H�$�H�V��	��		�	��v�
.�
.�C���s�O�O�O��M�"�I��r�<� � �'�(*�
�%�	�%�!�)�
��!�(.�(9�(9�(9�6�?�?�K�N�-��M�"�!�!�8�8�8�^�^�^�
=�
�	
�	
�
�*�	����J�	��'�(�/�/�#�q�*A�*A�!�*D�D�I����3�;�.�.��k��#�#�#�
&�
�
�	
�
�{�2�g�b�*�-�-�2�!�����r�{�L�1�1�	;�&/��%:�B�K�"����
��r�<�(�(�	2�&��1�B�M��rc�(�eZdZdd�Zd�Zd�Zd�ZdS)�PluginLoaderNc�0�||_i|_||_dSr)�group�impls�auto_fn)rr�r�s   rrzPluginLoader.__init__�s����
���
�����rc�8�|j���dSr)r��clearr!s rr�zPluginLoader.clear�s���
�������rc��||jvr|j|��S|jr+|�|��}|r||j|<|��S	ddl}|�|j|��D]&}|j|j|<|���cSn#t$rYnwxYwtjd|j�d|�����)NrzCan't load plugin: �:)	r�r��
pkg_resources�iter_entry_pointsr��loadr�r	�NoSuchModuleError)rri�loaderr��impls     rr�zPluginLoader.loads���4�:���#�4�:�d�#�%�%�%��<�	 ��\�\�$�'�'�F��
 �#)��
�4� ��v�x�x��	#� � � � �&�7�7��
�D�I�I�
#�
#��#'�9��
�4� ��y�y�{�{�"�"�"�
#���	�	�	��D�	�����#�#�*.�*�*�*�d�d�;�
�
�	
s�B�
B&�%B&c�*�����fd�}||j|<dS)Nc���tj���}��d��dd�D]}t||��}�t|���S)Nr�r)r�import_r�rs)�mod�token�
modulepath�objnames  ��rr�z#PluginLoader.register.<locals>.loadsY����.��,�,�C�#�)�)�#�.�.�q�r�r�2�
*�
*���c�5�)�)����3��(�(�(r)r�)rrir�r�r�s  `` r�registerzPluginLoader.registers6����	)�	)�	)�	)�	)�	)� ��
�4���rr)r1r2r3rr�r�r�r6rrr�r��sU����������
���
�
�
�. � � � � rr�c� �	tj}|j}|j}t	|jd|���t
|j|z��fS#t$r4tj
|��}|dt
|d��fcYSwxYw)Nrr)rk�CO_VARKEYWORDS�__code__�co_argcount�list�co_varnames�bool�co_flags�AttributeErrorrro)r`�co_varkeywords�co�nargsrvs     r�_inspect_func_argsr�#s���
� �/���[�����������'�(�(����~�-�.�.�
�	
���&�&�&�
�,�R�0�0���A�w��T�!�W�
�
�%�%�%�%�
&���s�A�;B
�B
c��|du}|rt��}|j�dd��}|o8t|tj��ot|jtj��}|r-t|��\}}|�	|��|s|sdS|r|r|j
D]}t||���n�|�d��|S)aeReturn the full set of inherited kwargs for the given `cls`.

    Probes a class's __init__ method, collecting all named arguments.  If the
    __init__ defines a \**kwargs catch-all, then the constructor is presumed
    to pass along unrecognized keywords to its base classes, and the
    collection process is repeated recursively on each of the bases.

    Uses a subset of inspect.getfullargspec() to cut down on method overhead,
    as this is used within the Core typing system to create copies of type
    objects which is a performance-sensitive operation.

    No anonymous tuple arguments please !

    NrFr)
rS�__dict__�getr��types�FunctionTyper��CodeTyper�r�	__bases__�get_cls_kwargs�discard)r@�_set�toplevel�ctr�has_initrw�has_kw�cs        rr�r�7s����t�|�H����u�u��

�,�
�
�:�u�
-�
-�C�	�	5��s�E�.�/�/�	5��s�|�U�^�4�4�
���*�3�/�/�
��v����E�����	�h�	��4���v����	�	�A��a��&�&�.���/�	�L�L������Krc�6�tj|��dS)z�Return the set of legal kwargs for the given `func`.

    Uses getargspec so is safe to call for methods, functions,
    etc.

    r)rro��funcs r�get_func_kwargsr�bs���(��.�.�q�1�1rFc	���tj|��rtd|z���tj|��rq|r[|rYt	j|��}t	j|jdd�|j|j	|j
|j|j|j
��St	j|��Stj|��r�|rg|s|jr^t	j|j��}t	j|jdd�|j|j	|j
|j|j|j
��St	j|j��Stj|��rt%|j|d���St)|d��rt	j|j��St)|d��rAtj|j��rt%|j|���Std	|z���td	|z���)
z�Return the argument signature for any callable.

    All pure-Python callables are accepted, including
    functions, methods, classes, objects with __call__;
    builtins and other edge cases like functools.partial() objects
    raise a TypeError.

    zCan't inspect builtin: %srNT)�no_self�_is_initr��__call__)r�zCan't inspect callable: %s)rk�	isbuiltin�	TypeErrorrlrro�FullArgSpec�args�varargs�varkw�defaults�
kwonlyargs�kwonlydefaults�annotationsrm�__self__r��isclass�get_callable_argspecrrGr�)r`r�r�rvs    rr�r�ms�������*;��3�b�8�9�9�9�	�	�B�	�	�(;��	5��	5��0��4�4�D��%��	�!�"�"�
����
��
����#�� ���
��0��4�4�4�	�	�"�	�	�;��	>��	>�B�K�	>��0���=�=�D��%��	�!�"�"�
����
��
����#�� ���
��0���=�=�=�	���	�	�;�#��K��4�
�
�
�	
�
��Z�	 �	 �;��,�R�[�9�9�9�	��Z�	 �	 �;���B�K�(�(�	?�'���W�E�E�E�E��8�2�=�>�>�>��4�r�9�:�:�:rTc���tj|��rtj|��}n|}tj|�}|dr|dd}n|drd|dz}nd}tj|d|d|dd|d��}d}|dr|t	|d��z
}|dr|t	|d��z
}|d|dz}|r|d|z
d�}nd}tj||d|d|d	��
��}	|rt||||	���St|dd�||dd�|	dd����S)
a�Returns a dictionary of formatted, introspected function arguments.

    A enhanced variant of inspect.formatargspec to support code generation.

    fn
       An inspectable callable or tuple of inspect getargspec() results.
    grouped
      Defaults to True; include (parens, around, argument) lists

    Returns:

    args
      Full inspect.formatargspec for fn
    self_arg
      The name of the first positional argument, varargs[0], or None
      if the function defines no positional arguments.
    apply_pos
      args, re-written in calling rather than receiving syntax.  Arguments are
      passed positionally.
    apply_kw
      Like apply_pos, except keyword-ish args are passed as keywords.

    Example::

      >>> format_argspec_plus(lambda self, a, b, c=3, **d: 123)
      {'args': '(self, a, b, c=3, **d)',
       'self_arg': 'self',
       'apply_kw': '(self, a, b, c=c, **d)',
       'apply_pos': '(self, a, b, c, **d)'}

    rrz%s[0]Nr�rer6c��d|zS)N�=r6)rs rrRz%format_argspec_plus.<locals>.<lambda>�s
��c�A�g�r)�formatvalue)r��self_arg�	apply_pos�apply_kwr�)r�callablero�inspect_formatargspec�lenrp)
r`rhrvr�r�r��num_defaults�	name_args�defaulted_valsr�s
          rrqrq�s���@��r�����,�R�0�0������'��.�D��A�w����7�1�:���	
�a����T�!�W�$������,��Q���a��$�q�'�4��a����I��L��A�w�%���D��G���$���A�w�%���D��G���$���Q��$�q�'�!�I���"�1�|�#3�#5�#5�6������+���Q���Q���%�%����H��

������	
�
�
�	
���a��d�����"��o��a��d�^�	
�
�
�	
rc��|tjur|rdpd}n(	t||���S#t$r	|rdpd}YnwxYwt	d|||���S)aformat_argspec_plus with considerations for typical __init__ methods

    Wraps format_argspec_plus with error handling strategies for typical
    __init__ cases::

      object.__init__ -> (self)
      other unreflectable (usually C) -> (self, *args, **kwargs)

    z(self)rrgz(self, *args, **kwargs)zself, *args, **kwargs)r�r�r�r�)�objectrrqr�rp)�methodrhr�s   r�format_argspec_initr��s������ � ��#�8�-�v���	�&�v�w�?�?�?�?���	�	�	��.�-�+�*�
�D�D�	������d�d�T�J�J�J�Js�(�;�;c��	tj|��S#t$r!|tjur	dgdddfcYSdgdddfcYSwxYw)z�inspect.getargspec with considerations for typical __init__ methods

    Wraps inspect.getargspec with error handling for typical __init__ cases::

      object.__init__ -> (self)
      other unreflectable (usually C) -> (self, *args, **kwargs)

    rNr��kwargs)rror�r�r)r�s r�getargspec_initr�sn��6��,�V�4�4�4���6�6�6��V�_�$�$��H�d�D�$�/�/�/�/��H�f�h��5�5�5�5�	6���s��A�A�Ac�V�t|tj��r|js|jS|S)zSAdjust the incoming callable such that a 'self' argument is not
    required.

    )r�r��
MethodTyper�r�)�func_or_clss r�unbound_method_to_callabler� s2���+�u�/�0�0���9M���#�#��rr6c	�V���|��g}ntj|��}t���g}tj��}d}t	|��D�]\}}	tj|j��}	|	jrt|	j��pd}
|dkrW|	j
r|	j
}|
r$|�|	jd|
���nR|�|	jdd���n/|�
�fd�|	jd|
�D����|
r@|�
d�t|	j|
d�|	j��D������
#t$rY��wxYwg}|��fd�|D����|�=t!�|��r-|�d�t#�|��D����|���D]P\}}
||vr�
	t#�|���}|�ur ||
kr|�|�d|�����A#t($rY�MwxYw|rN|D]K\}}
	t#�|���}|�ur ||
kr|�|�d|�����<#t($rY�HwxYw�jj�d	d
�|���d�S)z}Produce a __repr__() based on direct association of the __init__()
    specification vs. same-named attributes present.

    Nrrc���g|]}|�f��Sr6r6)r:�arg�missings  �r�
<listcomp>z generic_repr.<locals>.<listcomp>Ks���I�I�I��c�7�^�I�I�Irc��g|]	\}}||f��
Sr6r6)r:r��defaults   rrz generic_repr.<locals>.<listcomp>Ps0�����(�C���g����rc3�T�K�|]"}tt�|d����V��#dSr)�reprrs)r:r��objs  �rr<zgeneric_repr.<locals>.<genexpr>Ys7�����D�D�C�$�w�s�C��.�.�/�/�D�D�D�D�D�Drc�,�g|]}t|����Sr6�r)r:�vals  rrz generic_repr.<locals>.<listcomp>\s��@�@�@�S�t�C�y�y�@�@�@rr��(�, �))r�to_listr��OrderedDict�	enumeraterrorr�r�r��extendr�r�zipr�rGrs�itemsrHrn�	__class__r1r=)r�
additional_kw�
to_inspect�
omit_kwarg�pos_args�kw_args�vargsrP�insprv�default_len�outputr��defvalrr�s`              @r�generic_reprr,s[����
���U�
�
�!�)�*�5�5�
��h�h�G��H��&�(�(�G��E��Z�(�(�����4�	��0���?�?�D��-�>�C��
�,>�,>�C�!�K��A�v�v��<�)� �L�E��3��O�O�D�I�a���n�$=�>�>�>�>��O�O�D�I�a�b�b�M�2�2�2�2����I�I�I�I�t�y��K�<��/H�I�I�I�����
������,/� �I�{�l�m�m�4�d�m�-�-���������#�	�	�	��H�	����2�F�
�M�M�D�D�D�D�8�D�D�D�D�D�D���W�S�%�0�0���
�
�@�@�G�C��,?�,?�@�@�@�A�A�A��}�}�������V��*����	��#�s�G�,�,�C��'�!�!�c�V�m�m��
�
����c�c�2�3�3�3����	�	�	��D�	������(�	�	�K�C��
��c�3��0�0���g�%�%�#��-�-��M�M�S�S�S�#�#�"6�7�7�7����
�
�
���
�����}�-�-�-�t�y�y��/@�/@�/@�/@�A�As6�E�
E,�+E,�05H&�&
H3�2H3�5I6�6
J�Jc�0�eZdZdZdZd�Zd�Zd	d�Zd�ZdS)
�portable_instancemethodz_Turn an instancemethod into a (parent, name) pair
    to produce a serializable callable.

    )rfrir��__weakref__c�,�|j|j|jd�S)N�rfrir�r"r!s r�__getstate__z$portable_instancemethod.__getstate__|s ���k��I��k�
�
�	
rc�p�|d|_|d|_|�dd��|_dS)Nrfrir�r6)rfrir�r�)r�states  r�__setstate__z$portable_instancemethod.__setstate__�s1���H�o����&�M��	��i�i��"�-�-����rr6c�D�|j|_|j|_||_dSr)r�rfr1rir�)r�methr�s   rrz portable_instancemethod.__init__�s���m����M��	�����rc�v�|�|j��t|j|j��|i|��Sr)rr�rsrfri)rr��kws   rr�z portable_instancemethod.__call__�s9��
�	�	�$�+����.�w�t�{�D�I�.�.��:�r�:�:�:rN�r6)	r1r2r3r4r5r#r&rr�r6rrrrtsf��������
:�I�
�
�
�.�.�.�
����
;�;�;�;�;rrc�
��tjr(t|tj��rt��S|h�t|j��}|�r&|���}tjr/t|tj��r�>�fd�|jD��}n�fd�|jD��}|D],}|�	|����
|���-tjr|jdkst|d��s��n|jdkst|d��s�وfd�|���D��D],}|�	|����
|���-|��&t���S)a�Return an unordered sequence of all classes related to cls.

    Traverses diamond hierarchies.

    Fibs slightly: subclasses of builtin types are not returned.  Thus
    class_hierarchy(class A(object)) returns (A, object), not A plus every
    class systemwide that derives from object.

    Old-style classes are discarded and hierarchies rooted on them
    will not be descended.

    c3�X�K�|]$}|�v�t|tj��� |V��%dSr)r�r��	ClassType�r:�_�hiers  �rr<z"class_hierarchy.<locals>.<genexpr>�sE���������D�=�=��A�u��)G�)G�=�� �=�=�=��rc3�$�K�|]
}|�v�|V��dSrr6r/s  �rr<z"class_hierarchy.<locals>.<genexpr>�s'�����=�=�1�q��}�}�Q�}�}�}�}�=�=r�builtins�__subclasses__�__builtin__c���g|]}|�v�|��	Sr6r6r/s  �rrz#class_hierarchy.<locals>.<listcomp>�s���A�A�A��1�D�=�=�!�=�=�=r)rr�r�r�r.r��__mro__�popr�rHrXrr2rGr4)r@�processr�r[ra�sr1s      @r�class_hierarchyr;�s�����{���c�5�?�+�+�	��6�6�M��5�D��3�;���G�
���K�K�M�M���;�		>��!�U�_�-�-�
�����������E�E�>�=�=�=���=�=�=�E��	�	�A��N�N�1�����H�H�Q�K�K�K�K��;�	��|�z�)�)���<L�1M�1M�)��*��|�}�,�,�G��#�5�5�,��A�A�A�A�Q�-�-�/�/�A�A�A�	�	�A��N�N�1�����H�H�Q�K�K�K�K�9��:��:�:�rc#�~K�t|��}|D](}|jD]}||jvr||j|fV�n��)dS)z�iterate all the keys and attributes associated
    with a class, without using getattr().

    Does not use getattr() so that class-sensitive
    descriptors (i.e. property.__get__()) are not called.

    N)�dirr7r�)r@�keys�keyr�s    r�iterate_attributesr@�sl�����s�8�8�D�������	�	�A��a�j� � ��A�J�s�O�,�,�,�,���!���r�
self.proxyc����|r|}n ��d���fd�t|��D��}|D�]}	t||��}t|d��s�%t|d|��}n#t$rY�CwxYw	t	j|��}	t	j|	d��}
t	j|	ddd���}n#t$rd}
d	}YnwxYwd
t��z}|dur||ipi}
t	j	||
��	|j
|
|_
n#t$rYnwxYwt�||
|����dS)z9Automates delegation of __specials__ for a proxying type.N)r5�__del__�__getattribute__�
__metaclass__r#r&c���g|]B}|�d��r+|�d��rt�|��s|�v�@|��CS)�__)�
startswith�endswithrG)r:r�into_cls�skips  ��rrz0monkeypatch_proxied_specials.<locals>.<listcomp>�sl���	
�	
�	
�����T�"�"�		
�
�J�J�t�$�$�	
� ��!�,�,�
	
��T�M�M�

�"�M�Mrr�rjrrz(self, *args, **kw)z
(*args, **kw)z?def %(method)s%(fn_args)s: return %(name)s.%(method)s%(d_args)s)r=rsrGr�rror�r��locals�exec_rt�setattr)rJ�from_clsrK�onlyri�
from_instance�dundersr�r`rv�fn_args�d_args�pyr�s` `           r�monkeypatch_proxied_specialsrV�s������
�����<��D�	
�	
�	
�	
�	
���]�]�	
�	
�	
���/�/��	���6�*�*�B��2�z�*�*�
����Y��+�+�B�B���	�	�	��H�	����	%��0��4�4�D��2�4��7�;�;�G��1�$�q�'�!�"�"�+�>�>�F�F���	%�	%�	%�+�G�$�F�F�F�	%����

3�5;�X�X�
>�	�
�4�'�A�T�=�,A�G�R����R�����	�')��C��K�$�$���	�	�	��D�	������&�#�f�+�.�.�.�.�7/�/s<� A!�A!�!
A.�-A.�2AC�C�C�D�
D(�'D(c�F�t|d|��t|d|��uS)z;Return True if the two methods are the same implementation.r�)rs)�meth1�meth2s  r�methods_equivalentrZs0���5�*�e�,�,��
�z�5�1�1��rc	�`�|s|std���t|t��rt||��r|St|pd�t	|��D����}tt	|����}t
j}t|t��r|}n,|st��}t
j}nt|��}||�|��|��r|St|t��s<|t
jurdpd}t|�d|�dd�
|�������Gd�d	t��}|rd
|jz|_t��}	t|��D]w\}
}|
|vrtd|
z���tj|��st|
�d|�d
����t!||
t#|����|	�|
���x||	|��r|Stdd�
||	z
��z���)a�Ensure basic interface compliance for an instance or dict of callables.

    Checks that ``obj`` implements public methods of ``cls`` or has members
    listed in ``methods``. If ``required`` is not supplied, implementing at
    least one interface method is sufficient. Methods present on ``obj`` that
    are not in the interface are ignored.

    If ``obj`` is a dict and ``dict`` does not meet the interface
    requirements, the keys of the dictionary are inspected. Keys present in
    ``obj`` that are not in the interface will raise TypeErrors.

    Raises TypeError if ``obj`` does not meet the interface criteria.

    In all passing cases, an object with callable members is returned.  In the
    simple case, ``obj`` is returned as-is; if dict processing kicks in then
    an anonymous class is returned.

    obj
      A type, instance, or dictionary of callables.
    cls
      Optional, a type.  All public methods of cls are considered the
      interface.  An ``obj`` instance of cls will always pass, ignoring
      ``required``..
    methods
      Optional, a sequence of method names to consider as the interface.
    required
      Optional, a sequence of mandatory implementations. If omitted, an
      ``obj`` that provides at least one interface method is considered
      sufficient.  As a convenience, required may be a type, in which case
      all public methods of the type are required.

    z2a class or collection of method names are requiredc�<�g|]}|�d���|��S)r0)rH)r:rs  rrz as_interface.<locals>.<listcomp>Cs)��M�M�M�a�1�<�<��;L�;L�M��M�M�Mrzany ofzall ofz does not implement z: r
c��eZdZdZdS)�(as_interface.<locals>.AnonymousInterfacezA callable-holding shell.N)r1r2r3r4r6rr�AnonymousInterfacer^Zs������'�'�'�'rr_�	Anonymousz%r: unknown in this interfacer�z is not callablez,dictionary does not contain required keys %s)r�r�r�rSr=�operator�ge�gt�intersectionrpr=r�r1�dictlike_iteritemsrr�rN�staticmethodrX)rr@�methods�required�	interface�implemented�complies�	qualifierr_�foundr�r�s            r�as_interfacerns~��B�N�w�N��L�M�M�M��#�t�����C��!5�!5���
��G�M�M�M�3�s�8�8�M�M�M�N�N�I��c�#�h�h�-�-�K��{�H��(�D�!�!�!����
�!��5�5���;����x�=�=���x��(�(��3�3�X�>�>���
��c�4� � �
����+�8��D�H�	���s�s�I�I�I�t�y�y��3�3�3�
5�
�
�	
�
(�(�(�(�(�V�(�(�(��A�&1�C�L�&@��#��E�E�E�*�3�/�/��������"�"��;�f�D�E�E�E���t�$�$�	F��v�v�v�t�t�t�D�E�E�E��"�F�L��,>�,>�?�?�?�
�	�	�&������x��x� � �"�!�!�
�6�
�)�)�H�u�$�
%�
%�	&���rc�<�eZdZdZdd�Zd�Zd�Zed���ZdS)�memoized_propertyz2A read-only @property that is only evaluated once.Nc�H�||_|p|j|_|j|_dSr)�fgetr4r1)rrrr�s   rrzmemoized_property.__init__us$����	��*�d�l����
��
�
�
rc�V�|�|S|�|��x|j|j<}|Sr)rrr�r1)rrr@�results    r�__get__zmemoized_property.__get__zs.���;��K�/3�y�y��~�~�=���T�]�#�f��
rc�F�t�||j��dSr)rp�resetr1)rrs  r�_resetzmemoized_property._reset�s ������T�]�3�3�3�3�3rc�<�|j�|d��dSr)r�r8)r@rris   rrwzmemoized_property.reset�s �������t�$�$�$�$�$rr)	r1r2r3r4rrurx�classmethodrwr6rrrprprsg������<�<�&�&�&�&�
���4�4�4��%�%��[�%�%�%rrpc�.���fd�}t|���S)z�Decorate a method memoize its return value.

    Best applied to no-arg methods: memoization is not sensitive to
    argument values, and will always return the same value even when
    called with different arguments.

    c�z����|g|�Ri|����fd�}�j|_�j|_||j�j<�S)Nc����Srr6��ar*rts  �r�memoz6memoized_instancemethod.<locals>.oneshot.<locals>.memo�s����Mr)r1r4r�)rr�r*r�rtr`s    @�r�oneshotz(memoized_instancemethod.<locals>.oneshot�sc������D�&�4�&�&�&�2�&�&��	�	�	�	�	����
��z���%)��
�b�k�"��
rr)r`r�s` r�memoized_instancemethodr��s.���	�	�	�	�	��'�2�&�&�&rc�,�eZdZdZdd�Zd�Zd�Zd�ZdS)	�!group_expirable_memoized_propertyz?A family of @memoized_properties that can be expired in tandem.r6c�P�g|_|r|j�|��dSdSr)�
attributesr)rr�s  rrz*group_expirable_memoized_property.__init__�s7������	/��O�"�"�:�.�.�.�.�.�	/�	/rc�T�|j}|jD]}|�|d���dS)z.Expire all memoized properties for *instance*.N)r�r�r8)r�instance�stash�	attributes    r�expire_instancez1group_expirable_memoized_property.expire_instance�s<���!����	'�	'�I��I�I�i��&�&�&�&�	'�	'rc�^�|j�|j��t|��Sr)r�rHr1rp�rr`s  rr�z*group_expirable_memoized_property.__call__�s(������r�{�+�+�+� ��$�$�$rc�^�|j�|j��t|��Sr)r�rHr1r�r�s  rr�z(group_expirable_memoized_property.method�s(������r�{�+�+�+�&�r�*�*�*rNr+)r1r2r3r4rr�r�r�r6rrr�r��s[������I�I�/�/�/�/�
'�'�'�%�%�%�+�+�+�+�+rr�c�"�eZdZdZdZd�Zd�ZdS)�
MemoizedSlotsz�Apply memoized items to an object using a __getattr__ scheme.

    This allows the functionality of memoized_property and
    memoized_instancemethod to be available to a class using __slots__.

    r6c� �t|���r)r�)rr?s  r�_fallback_getattrzMemoizedSlots._fallback_getattr�s���S�!�!�!rc�r������d��rt����t�d�z��r.t�d�z����}t	��|��|St�d�z��r(t�d�z������fd�}�j|_|S�����S)N�	_memoizedz_memoized_attr_%sz_memoized_method_%sc�v����|i|����fd�}�j|_�j|_t��|���S)Nc����Srr6r~s  �rr�z8MemoizedSlots.__getattr__.<locals>.oneshot.<locals>.memo�s���!�Mr)r1r4rN)r�r*r�rtr`r?rs   @���rr�z*MemoizedSlots.__getattr__.<locals>.oneshot�sY������T��R����"�"�"�"�"�!#���
�!�z�����c�4�(�(�(��
r)rHr�rGrsrNr4r�)rr?r*r�r`s``  @r�__getattr__zMemoizedSlots.__getattr__�s�������>�>�+�&�&�	/� ��%�%�%�
�T�.��4�
5�
5�	/�<�G�D�"5��";�<�<�>�>�E��D�#�u�%�%�%��L�
�T�0�3�6�
7�
7�	/���4�s�:�;�;�B�	
�	
�	
�	
�	
�	
�	
�!�j�G�O��N��)�)�#�.�.�.rN)r1r2r3r4r5r�r�r6rrr�r��sC���������I�"�"�"�/�/�/�/�/rr�c������fd�}|S)Nc�����d��}tjd�|dd���t	��t��|dg��}t
||d��}t||j|���r/t|d��r|j
�|j��|S)Nr�rr��__all__)r�rr�r=�globalsrLrsrNr1rGr�rH)r�tokensr��
add_to_all�
modulenames   ��rr}z dependency_for.<locals>.decorate�s�����!�!�#�&�&���n��H�H�V�A�b�D�\�"�"�G�I�I�v�x�x�&��*��
�
���c�6�"�:�&�&����S�\�3�'�'�'��	-�'�#�y�1�1�	-��K���s�|�,�,�,��
rr6)r�r�r}s`` r�dependency_forr��s)����	�	�	�	�	�	��Orc���t|tj��rD|������}|dvrdS|dvrdStd|z���t
|��S)N)�true�yes�on�y�t�1T)�false�no�offr;�f�0FzString is not true/false: %r)r�r�string_types�stripr9�
ValueErrorr�)rs r�asboolr��ss���#�v�*�+�+�C��i�i�k�k���!�!���6�6�6��4�
�9�
9�
9��5��;�c�A�B�B�B���9�9�rc����fd�}|S)zqReturn a callable that will evaluate a string as
    boolean, or one of a set of "alternate" string values.

    c�.��|�vr|St|��Sr)r�)r�texts �r�
bool_or_valuez"bool_or_str.<locals>.bool_or_value�s����$�;�;��J��#�;�;�rr6)r�r�s` r�bool_or_strr��s$���������rc�(�|�|St|��S)zCoerce to integer.)�int)r*s r�asintr�s��
�}����u�:�:�rc��|�|}||vrnt|t��rt|||��sG||�=|tur|rt||��||<dS|||��||<dSdSdSdS)z�If 'key' is present in dict 'kw', coerce its value to type 'type\_' if
    necessary.  If 'flexi_bool' is True, the string '0' is considered false
    when coercing to boolean.
    N)r�r�r�r�)r*r?r)�
flexi_bool�dests     r�coerce_kw_typer�s����|���	�r�	�	��E�4�(�(�	�0:�2�c�7�E�0J�0J�	��s�G���D�=�=�Z�=��r�#�w���D��I�I�I���b��g���D��I�I�I�	�	���	�	rc���t|��}|��fd�|�|��D����||i|��S)z�Instantiate cls using the __dict__ of obj as constructor arguments.

    Uses inspect to match the named arguments of ``cls``.

    c3�H�K�|]}|�jv�|�j|fV��dSr)r�)r:�krs  �rr<z#constructor_copy.<locals>.<genexpr>,sC�������!"�a�3�<�>O�>O��C�L��O��>O�>O�>O�>O��r)r�r�
difference)rr@r�r*rws`    r�constructor_copyr�$ss���
�3���E��I�I�����&+�&6�&6�r�&:�&:��������3������rc�z���tj����tjd�����fd�}|S)z%Return a threadsafe counter function.rc�������	t�������S#����wxYwr)�acquire�next�release)�counter�locks��r�_nextzcounter.<locals>._next9s?���������	���=�=��L�L�N�N�N�N��D�L�L�N�N�N�N���s	�:�A)r�	threading�LockrT�count)r�r�r�s @@rr�r�2sN������ � �"�"�D��o�a� � �G��������Lrc���t|d��r/|j�!t|jt��rtS|jSt	|t
��rtpt}||t��rtS||t��rtS||t��rtSt|d��rtSt|d��rtSt|d��rtS|S)z�Given an instance or class, guess if it is or is acting as one of
    the basic collection types: list, set and dict.  If the __emulates__
    property is present, return that preferentially.
    �__emulates__NrHrXrS)rGr��
issubclassrSr�r�r�rp)�specimenr�isas   r�duck_type_collectionr�Cs����x��(�(�)�� �,���!�3�2
�2
�,��J��(�(�
�X�t�
$�
$�
3��
A�z�C�
�s�8�T������	��X�s�	�	���
�	��X�t�	�	�����x��"�"����	��5�	!�	!���
�	��5�	!�	!�����rc
�6�t||��r|St|t��rHtjd|�dd�d�|D�����dt|���d����tjd|�d|�dt|���d����)	Nz
Argument 'z ' is expected to be one of type z or c3� K�|]	}d|zV��
dS)z'%s'Nr6)r:rs  rr<z"assert_arg_type.<locals>.<genexpr>ks&����$A�$A�A�V�a�Z�$A�$A�$A�$A�$A�$Arz, got '�'z' is expected to be of type 'z', got ')r�rIr	�
ArgumentErrorr=r�)r��argtyperis   r�assert_arg_typer�ds����#�w�����
��g�u�%�%�		��#�#��4�4����$A�$A��$A�$A�$A�A�A�A�A�4��9�9�9�9�N���
�
�#�#��4�4����$�s�)�)�)�)�-���
rc	�r���tjr2t�d��r!t������SnUt�d��r����St�d��r!t
������St�dt�dd�������td�z���t�d��r��fd�}|��St�d	��r-t
�fd
���	��D����Std�z���)z?Return a (key, value) iterator for almost any dict-like object.r�	iteritems�__getitem__r�NzObject '%r' is not dict-like�iterkeysc3�X�K�����D]}|�|��fV��dSr)r�)r?�dictlike�getters ��r�iteratorz$dictlike_iteritems.<locals>.iterator�sH������(�(�*�*�
'�
'���6�6�#�;�;�&�&�&�&�&�
'�
'rr>c3�2�K�|]}|�|��fV��dSrr6)r:r?r�s  �rr<z%dictlike_iteritems.<locals>.<genexpr>�s0�����B�B�3�S�&�&��+�+�&�B�B�B�B�B�Br)
rrrGr�rr��iterrsr�r>)r�r�r�s` @rreretsV�����{�*��8�W�%�%�	*�����(�(�)�)�)�	*��8�[�)�)�	*��%�%�'�'�'�
�X�w�
'�
'�	*�����(�(�)�)�)�
�X�}�g�h��t�.L�.L�
M�
M�F�
�~��6��A�B�B�B��x��$�$�
C�	'�	'�	'�	'�	'�	'��x�z�z��	��6�	"�	"�C��B�B�B�B�(�-�-�/�/�B�B�B�B�B�B��6��A�B�B�Brc�(��eZdZdZ�fd�Zd�Z�xZS)�
classpropertyaAA decorator that behaves like @property except that operates
    on classes rather than instances.

    The decorator is currently special when using the declarative
    module, but note that the
    :class:`~.sqlalchemy.ext.declarative.declared_attr`
    decorator should be used for this purpose with declarative.

    c�h��tt|��j|g|�Ri|��|j|_dSr)�superr�rr4)rrrr�r*rs    �rrzclassproperty.__init__�s=���+��m�T�"�"�+�D�=�3�=�=�=�"�=�=�=��|����rc�,�|�|��Sr)rr)�descrr@s   rruzclassproperty.__get__�s���y�y��~�~�r)r1r2r3r4rru�
__classcell__�rs@rr�r��sQ���������$�$�$�$�$�������rr�c��eZdZd�Zd�ZdS)�hybridpropertyc��||_dSrr��rr�s  rrzhybridproperty.__init__��
����	�	�	rc��|�(|�|��}|jj|_|S|�|��Sr)r�r4)rr��owner�clsvals    rruzhybridproperty.__get__�s<�����Y�Y�u�%�%�F�!�Y�.�F�N��M��9�9�X�&�&�&rN)r1r2r3rrur6rrr�r��s2���������'�'�'�'�'rr�c��eZdZdZd�Zd�ZdS)�hybridmethodz/Decorate a function as cls- or instance- level.c��||_dSrr�r�s  rrzhybridmethod.__init__�r�rc�|�|� |j�||j��S|j�||��Sr)r�rur)rr�r�s   rruzhybridmethod.__get__�s:�����9�$�$�U�E�O�<�<�<��9�$�$�X�u�5�5�5rN)r1r2r3r4rrur6rrr�r��s8������9�9����6�6�6�6�6rr�c�(�eZdZdd�Zd�Zd�Zd�ZdS)�_symbolNc��t|tj��sJ�|�t|��}t�t|��}||_|r||_|S)zConstruct a new named symbol.)	r�rr��hashr��__new__r�rir4)rrir��	canonical�vs     rr�z_symbol.__new__�sZ���$�� 3�4�4�4�4�4����T�
�
�I��K�K���+�+������	��A�I��rc�>�t|jdt|��ffS)Nr)r�rir�r!s r�
__reduce__z_symbol.__reduce__�s����	�3��D�	�	�2�2�2rc� �t|��Srrr!s r�__str__z_symbol.__str__�s���D�z�z�rc��d|jzS)Nz
symbol(%r))rir!s r�__repr__z_symbol.__repr__�s���d�i�'�'r�NN)r1r2r3r�r�rrr6rrr�r��sU������	�	�	�	�3�3�3����(�(�(�(�(rr�r�c�j�eZdZdZiZej���Zdd�Z	e
	dd���ZdS)r�a�A constant symbol.

    >>> symbol('foo') is symbol('foo')
    True
    >>> symbol('foo')
    <symbol 'foo>

    A slight refinement of the MAGICCOOKIE=object() pattern.  The primary
    advantage of symbol() is its repr().  They are also singletons.

    Repeated calls of symbol('name') will all return the same instance.

    The optional ``doc`` argument assigns to ``__doc__``.  This
    is strictly so that Sphinx autoattr picks up the docstring we want
    (it doesn't appear to pick up the in-module docstring if the datamember
    is in a different module - autoattribute also blows up completely).
    If Sphinx fixes/improves this then we would no longer need
    ``doc`` here.

    Nc�*�|j���	|j�|��}|�t	|||��x|j|<}|t
j���S#t
j���wxYwr)�_lockr��symbolsr�r�r�r�)r@rir�r�r]s     rr�zsymbol.__new__�s����	������	#��+�/�/�$�'�'�C��{�*1�$��Y�*G�*G�G���D�!�C���L� � �"�"�"�"��F�L� � �"�"�"�"���s�8A2�2 BFc��|���D]&\}}||ur|cS|r||jkr|cS||vr|cS�'|�dStjd|�d|�����)a�Given a user parameter, parse the parameter into a chosen symbol.

        The user argument can be a string name that matches the name of a
        symbol, or the symbol object itself, or any number of alternate choices
        such as True/False/ None etc.

        :param arg: the user argument.
        :param choices: dictionary of symbol object to list of possible
         entries.
        :param name: name of the argument.   Used in an :class:`.ArgumentError`
         that is raised if the parameter doesn't match any available argument.
        :param resolve_symbol_names: include the name of each symbol as a valid
         entry.

        NzInvalid value for 'z': )rrir	r�)r@r��choicesri�resolve_symbol_namesr]�choices       r�parse_user_argumentzsymbol.parse_user_argument�s���,#�=�=�?�?�	�	�K�C���c�z�z��
�
�
�%�
�#���/�/��
�
�
������
�
�
���;��4�������c�c� J�K�K�Krrr0)r1r2r3r4rrr�r�rr�rzrr6rrr�r��sv��������*�G���!�!�#�#�E�#�#�#�#��6;� L� L� L��[� L� L� Lrc�2�t|_tdz
adS)z�Assign a '_creation_order' sequence to the given instance.

    This allows multiple instances to be sorted in order of creation
    (typically within a single thread; the counter is not particularly
    threadsafe).

    rN)�_creation_order)r�s r�set_creation_orderr!s�� /�H���q��O�O�Orc��	||i|��S#t$r/tdtj��dd�z��YdSwxYw)zXexecutes the given function, catches all exceptions and converts to
    a warning.

    z%s('%s') ignoredrrN)rnr(rr )r�r�r�s   r�warn_exceptionr.sc��
7��t�T�$�V�$�$�$���7�7�7��
�#�,�.�.��1��"5�
5�6�6�6�6�6�6�7���s�
�5A�A�c�l�	t|��|kr
d|d|�zS|S#t$r|cYSwxYw)Nz%s...r)r�r�)r*�len_s  r�ellipses_stringr9sT����u�:�:�����U�1�T�6�]�*�*��L�������������s�$�$�3�3c�.��eZdZdZ�fd�Zd�Zd�Z�xZS)�_hash_limit_stringa/A string subclass that can only be hashed on a maximum amount
    of unique values.

    This is used for warnings so that we can send out parameterized warnings
    without the __warningregistry__ of the module,  or the non-overridable
    "once" registry within warnings.py, overloading memory,


    c����||zd|zz}tt|���||��}td|t|��|zfz��|_|S)Nz6 (this warning may be suppressed after %d occurrences)z%s_%d)r�rr�r��_hash)r@r*�numr��interpolatedrrs      �rr�z_hash_limit_string.__new__Nsf������D�s�J�
���'��-�-�5�5�c�<�H�H���'�U�D��,>�,>��,D�$E�E�F�F��
��rc��|jSr)rr!s r�__hash__z_hash_limit_string.__hash__Vs
���z�rc�B�t|��t|��kSr)r�)r�others  r�__eq__z_hash_limit_string.__eq__Ys���D�z�z�T�%�[�[�(�(r)r1r2r3r4r�rr r�r�s@rrrCs`�����������������)�)�)�)�)�)�)rrc�H�tj|tjd���dS)zdIssue a warning.

    If msg is a string, :class:`.exc.SAWarning` is used as
    the category.

    r��
stacklevelN)�warningsr(r	�	SAWarning)�msgs rr(r(]s#��
�M�#�s�}��3�3�3�3�3�3rc�n�|rt|d|��}tj|tjd���dS)z\Issue a warning with a parameterized string, limiting the number
    of registrations.

    �
rr"N)rr$r(r	r%)r&r�s  r�warn_limitedr)gs<��
�0� ��b�$�/�/���M�#�s�}��3�3�3�3�3�3rc� �����g����fd�}|S)zNDecorate the given function to be a no-op after it is called exactly
    once.c����}�r;����}	||i|��S#�r��d|���xYwdS)Nr)r8�insert)r�r*�	strong_fn�once_fnr`�once�retry_on_exceptions    ���r�gozonly_once.<locals>.gowsk����	��	��h�h�j�j�G�
��w��*�r�*�*�*��
�%�,��K�K��7�+�+�+�����	�	s�#�>r6)r`r0r1r/s`` @r�	only_oncer2qs8�����
�4�D���������Irz%sqlalchemy/([a-z_]+/){0,2}[a-z_]+\.pyzunit(?:2|test2?/)c�`�d}t|��dz
}||krA|�||��r&|dz
}||kr|�||���&||krA|�||��r&|dz}||kr|�||���&|||dz�S)atChop extraneous lines off beginning and end of a traceback.

    :param tb:
      a list of traceback lines as returned by ``traceback.format_stack()``

    :param exclude_prefix:
      a regular expression object matching lines to skip at beginning of
      ``tb``

    :param exclude_suffix:
      a regular expression object matching lines to skip at end of ``tb``
    rr)r��search)�tb�exclude_prefix�exclude_suffixrD�ends     r�chop_tracebackr9�s���
�E�

�b�'�'�A�+�C�
�3�,�,�>�0�0��E��;�;�,�
��
���3�,�,�>�0�0��E��;�;�,�
�3�,�,�>�0�0��C��9�9�,��q����3�,�,�>�0�0��C��9�9�,�
�e�c�A�g�o��rc�|�d|z}t�����}t||��|dS)Nz&def set(obj, value):    obj.%s = valuerS)rL�copyr�)�attrnamer{r�s   r�
attrsetterr=�s4��6��A�D�
�(�(�-�-�/�/�C���s�O�O�O��u�:�rc�(��eZdZdZ�fd�Zd�Z�xZS)�EnsureKWArgTypezYApply translation of functions to accept \**kw arguments if they
    don't already.

    c�B��|j}|rj|D]g}tj||��}|rN||}tj|��}|js+|�|��x||<}	t|||	���htt|���
|||��dSr)�ensure_kwargr>�matchrror��
_wrap_w_kwrNr�r?r)r@�clsnamer[�clsdict�fn_regr?rr`rv�wrappedrs          �rrzEnsureKWArgType.__init__�s�����!���	3��
3�
3���H�V�S�)�)���3� ���B�!�8��<�<�D��:�3�14����1C�1C�C����w���S�'�2�2�2��
�o�s�#�#�,�,�W�e�W�E�E�E�E�Erc�.���fd�}t|���S)Nc����|�Srr6)r�r*r`s  �r�wrapz(EnsureKWArgType._wrap_w_kw.<locals>.wrap�s����2�s�8�Orr)rr`rJs ` rrCzEnsureKWArgType._wrap_w_kw�s.���	�	�	�	�	��d�B�'�'�'r)r1r2r3r4rrCr�r�s@rr?r?�sV���������
F�F�F�F�F�(�(�(�(�(�(�(rr?c�0�t|d��rt||��S|}|jj|_t|d��r|j|_t|jd��r|jjr|jj|_n|jr|j|_|S)z�Augment functools.update_wrapper() to work with objects with
    a ``__call__()`` method.

    :param fn:
      object with __call__ method

    r1r2r4)rGrrr1r2r�r4)�wrapperr`�_fs   r�
wrap_callablerN�s����r�:���
��g�r�*�*�*�
���l�+����2�|�$�$�	*��M�B�M��2�;�	�*�*�	$�r�{�/B�	$���,�B�J�J�
�Z�	$���B�J��	rc��d|vr|�d��Sd}gg}d}t|��}||kr�||}|dkrE|dkr9||dz
kr0||dzdkr!|d�d��|dz
}nC|dz}n=|dkr|dkr|�g��n|d�|��|dz
}||k��d�|D��S)a�Parse a dotted identifier with accommodation for quoted names.

    Includes support for SQL-style double quotes as a literal character.

    E.g.::

        >>> quoted_token_parser("name")
        ["name"]
        >>> quoted_token_parser("schema.name")
        ["schema", "name"]
        >>> quoted_token_parser('"Schema"."Name"')
        ['Schema', 'Name']
        >>> quoted_token_parser('"Schema"."Name""Foo"')
        ['Schema', 'Name""Foo']

    �"r�rrr�c�8�g|]}d�|����S)�)r=)r:r�s  rrz'quoted_token_parser.<locals>.<listcomp>s"��/�/�/�u�B�G�G�E�N�N�/�/�/r)r�r�rH)r*r%rt�idx�lv�chars      r�quoted_token_parserrV�s��$�%����{�{�3����
�E��T�F�
�C�	�U���B�

��(�(��S�z���3�;�;���z�z�c�B��F�l�l�u�S�1�W�~��/D�/D��r�
�!�!�#�&�&�&��q������
���
�S�[�[�U�a�Z�Z��M�M�"������2�J���d�#�#�#��q�����(�(�0�/��/�/�/�/rc�>���tj������fd�}|S)Nc�v��|jdur|jpd}|rt|�fd��D����}||_|S)NrRc���i|]}|���Sr6r6)r:�paramr�s  �r�
<dictcomp>z8add_parameter_text.<locals>.decorate.<locals>.<dictcomp>s���)J�)J�)J�%�%��)J�)J�)Jr)r4�inject_param_text)r`r��paramsr�s  ��rr}z$add_parameter_text.<locals>.decoratesT����j��$�3���9�r���	L�#�C�)J�)J�)J�)J�6�)J�)J�)J�K�K�C���
��	r)rr)r]r�r}s`` r�add_parameter_textr^	s9����
�
!�&�
)�
)�F��������Orc���|�dd��}t|��dkr|S|\}}|�d��s|dztj|��zStj|��S)Nr&rr%)r�r�rH�textwrap�dedent)r��
split_text�	firstline�	remainings    r�_dedent_docstringresu�����D�!�$�$�J�
�:���!�����)��	�9�����$�$�%��4��(�/�)�"<�"<�<�<���t�$�$�$rc�,�t|pd��}|�d��}t|��dkr|�d��t	j|���d��}|dr|�dd��d�t|��D��}|�dd��|t|t|��dz
��}|d|�|z||d�z}d�	|��S)NrRr&rrc�@�g|]\}}|����|��Sr6)r�)r:r�lines   rrz)inject_docstring_text.<locals>.<listcomp>+s)��
H�
H�
H�i�c�4�4�:�:�<�<�
H�c�
H�
H�
Hr)
rer�r�rHr`rar,r�minr=)�doctext�
injecttext�pos�lines�injectlines�blanks�
inject_poss       rr�r�"s����
�2�.�.�G��M�M�$���E�
�5�z�z�Q���
���R�����/�*�-�-�3�3�D�9�9�K��1�~�"����1�b�!�!�!�
H�
H�9�U�#3�#3�
H�
H�
H�F�
�M�M�!�Q������C��V���q��1�1�2�J��!�J�,��+�-��j�k�k�0B�B�E��9�9�U���rc�8�|���}g}d}|�r�|�d��}|��tjd|��}|r�|�d��}||vrwdt|�d����zdz}|rBtjd|d��}	|	r%dt|	�d����z}|||z}�n|����d��rB|�d��|�|��|�d��d}n�|�	��sB|�|��|�|��|�d��d}nT|�
d	��r?|�|��|�|�d�������|�|��|���d�|��S)
Nrz(\s+):param (?:\\\*\*?)?(.+?):rr%rz(\s+)\Sz:param r&z::)�
splitlinesr8r>rBr�r��lstriprHrH�rstriprIr=)
rj�
inject_params�doclinesrm�	to_injectrhrrZ�indent�m2s
          rr\r\4s
���!�!�#�#�H��E��I�
�$��|�|�A��������:�D�A�A�A��

>�����
�
���M�)�)� �3�q�w�w�q�z�z�?�?�2�S�8�F� �<��X�j�(�1�+�>�>���<�%(�3�r�x�x��{�{�+;�+;�%;�F� &��u�)=� =�I��
�[�[�]�]�
%�
%�i�
0�
0�	��L�L������L�L��#�#�#��L�L������I�I������	��L�L������L�L��#�#�#��L�L������I�I�
�]�]�4�
 �
 �	�
�L�L������L�L����Q���
�
�
�
�
���T����I�$�L�9�9�U���rc�*�t|��dkrdSt|��dk}|r
|dd�n|dd�|dd�z}d�|D��}|rd�|��Sd�|dd����d|d��S)	z�Trims a list of strings from the middle and return a string of up to
    four elements. Strings greater than 11 characters will be truncatedrNr�rer�c�R�g|]$}t|��dkr
d|dd�zn|��%S)�z%s..N)r�)r:ris  rrz$repr_tuple_names.<locals>.<listcomp>is8��
L�
L�
L�d��T���R���6�D��"��I���T�
L�
L�
Lrr
z, ..., )r�r=)rw�flag�ress   r�repr_tuple_namesrbs����5�z�z�Q����t��u�:�:��?�D��;�E�!�A�#�J�J�E�!�A�#�J��r�s�s��$;�E�
L�
L�e�
L�
L�
L�C��>��y�y��~�~�� $�	�	�#�a��c�(� 3� 3� 3� 3�S��W�W�=�=rr)FF)T)r6Nr6)NNrAN)NNNr0)TN)r)Xr4�	functoolsrr
rkrTrar>rr`r�r$rRrrr	rr�rrArLr^rbr~rrr�r�r�r�r�r�rqr�r�r�rrr;r@rVrZrnrpr�r�r�r�r�r�r�r�r�r�r�r�re�propertyr�r�r�r�r�r1r�rrrr�	text_typerr(r)r2�compile�_SQLA_RE�_UNITTEST_REr9r��NoneTyper=r?rNrVr^rer�r\rr6rr�<module>r�s�����%�$�$�$�$�$�����������������	�	�	�	�
�
�
�
����������������������������������.;�.;�.;�.;�.;�6�.;�.;�.;�b������
M�
M�
M� ���,�,�,�>���
P�P�P�P�f' �' �' �' �' �6�' �' �' �T
�
�
�((�(�(�(�V2�2�2�3;�3;�3;�3;�lP
�P
�P
�P
�fK�K�K�K�06�6�6�$	�	�	�EB�EB�EB�EB�P;�;�;�;�;�f�;�;�;�<0�0�0�f
�
�
�&
�	
�	��
</�</�</�</�~���S�S�S�S�l%�%�%�%�%��%�%�%�,'�'�'�.+�+�+�+�+��+�+�+�.%/�%/�%/�%/�%/�F�%/�%/�%/�P����	�	�	�������'�'�'�'�(������"����B
�
�
� C�C�C�:�����H����&
'�
'�
'�
'�
'�V�
'�
'�
'�
6�
6�
6�
6�
6�6�
6�
6�
6�(�(�(�(�(�c�(�(�(�,���DL�DL�DL�DL�DL�V�DL�DL�DL�N��
�
�
�7�7�7�����)�)�)�)�)��)�)�)�)�44�4�4�4�4�4����,�2�:�>�?�?���r�z�.�/�/��'3�8�����,�4��:�:�����(�(�(�(�(�d�(�(�(�4���0)0�)0�)0�X
�
�
�	%�	%�	%����$+�+�+�\>�>�>�>�>r

Hacked By AnonymousFox1.0, Coded By AnonymousFox