Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/sqlalchemy/sql/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/sqlalchemy/sql/__pycache__/functions.cpython-311.pyc

�

�܋f�����dZddlmZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lm
Z
ddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZej e!��Z"ej d���Z#ej$dd���Z%dud!�Z&Gd"�d#e
ee��Z'Gd$�d%e��Z(Gd&�d'e)��Z*e*��Z+e*je+_e*d(�)��Z,Gd*�d+e'��Z-Gd,�d-e��Z.Gd.�d/ej/e.e-����Z0e&d0e��e&d1e��Gd2�d3e0��Z1Gd4�d5e0��Z2Gd6�d7e0��Z3Gd8�d9e3��Z4Gd:�d;e3��Z5Gd<�d=e3��Z6Gd>�d?e3��Z7Gd@�dAe0��Z8GdB�dCe0��Z9GdD�dEe0��Z:GdF�dGe0��Z;GdH�dIe0��Z<GdJ�dKe2��Z=GdL�dMe2��Z>GdN�dOe2��Z?GdP�dQe2��Z@GdR�dSe2��ZAGdT�dUe2��ZBGdV�dWe2��ZCGdX�dYe2��ZDGdZ�d[e2��ZEGd\�d]e0��ZFGd^�d_e0��ZGGd`�daeG��ZHGdb�dceG��ZIGdd�deeG��ZJGdf�dge0��ZKGdh�die0��ZLGdj�dke0��ZMGdl�dme0��ZNGdn�doe0��ZOGdp�dqe0��ZPGdr�dse0��ZQdtS)vz6SQL function API, factories, and built-in functions.

�)�
annotation)�	operators)�schema)�sqltypes)�util)�ColumnCollection)�
Executable)�_clone��_literal_as_binds)�_type_from_args)�BinaryExpression)�
BindParameter)�Cast)�
ClauseList)�
ColumnElement)�Extract��FunctionFilter)�Grouping)�literal_column��Over��WithinGroup)�Alias)�
FromClause)�Select)�
VisitableType�c�4�tjt��S�N)r�defaultdict�dict���O/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/sql/functions.py�<lambda>r((s��D�4D�T�4J�4J�r&�case_sensitive_functionzHSymbol to mark the functions that are switched into case-sensitive mode.)�name�doc�_defaultc	��t|}t|}|}tj|�����}||vr�||t
ur�|||vr-tjd�|����|||<n�tjd�|t||�
����d����t
||<n�||vr�|||vrNtjd�t||�
����|����n-tjd�|����n|||<||||<dS)z�Associate a callable with a particular func. name.

    This is normally called by _GenericMeta, but is also
    available by itself so that a non-Function construct
    can be associated with the :data:`.func` accessor (i.e.
    CAST, EXTRACT).

    zMThe GenericFunction '{}' is already registered and is going to be overridden.z�GenericFunction '{}' is already registered with different letter case, so the previously registered function '{}' is switched into case-sensitive mode. GenericFunction objects will be fully case-insensitive in a future release.�z�GenericFunction(s) '{}' are already registered with different letter cases and might interact with '{}'. GenericFunction objects will be fully case-insensitive in a future release.zLThe GenericFunction '{}' is already registered and is going to be overriden.N)�	_registry�_case_sensitive_registryr�	text_type�lower�_CASE_SENSITIVE�warn�format�warn_deprecated�list�keys�sorted)�
identifier�fn�package�reg�case_sensitive_reg�raw_identifiers      r'�register_functionr@0s����G�
�C�1�'�:���N���
�+�+�1�1�3�3�J��S���S��_�O�C�C��/�
�;�;�;��I�-�-3�V�J�-?�-?�
�
�
�!�C�
�O�O�

� �"�#)�&�"��+�J�7�<�<�>�>�?�?��B�#�#�	
�	
�	
�.�C�
�O�O�
�)�	)�	)��!3�J�!?�?�?�� �"�#)�&��-�j�9�>�>�@�@�A�A�"�#�#�	
�
�
�
�
�I�,�,2�F�>�,B�,B�
�
�
�
���J��68��z�"�>�2�2�2r&c����eZdZdZdZdZd�Zd�Zed���Z	e
jd���Zdd	�Z
d
�Zd�Zd�Zed
���Zd�Zefd�Zd�Zdd�Zd�Zd�Zd�Zdd�Zd�fd�	Z�xZS)�FunctionElementazBase for SQL function-oriented constructs.

    .. seealso::

        :ref:`coretutorial_functions` - in the Core tutorial

        :class:`.Function` - named SQL function.

        :data:`.func` - namespace which produces registered or ad-hoc
        :class:`.Function` instances.

        :class:`.GenericFunction` - allows creation of registered function
        types.

    r%Fc����fd�|D��}�jpt|���_t|tjdd������_dS)aOConstruct a :class:`.FunctionElement`.

        :param \*clauses: list of column expressions that form the arguments
         of the SQL function call.

        :param \**kwargs:  additional kwargs are typically consumed by
         subclasses.

        .. seealso::

            :data:`.func`

            :class:`.Function`

        c�:��g|]}t|�j����Sr%�rr*��.0�c�selfs  �r'�
<listcomp>z,FunctionElement.__init__.<locals>.<listcomp>�s&���A�A�A�A�!�!�T�Y�/�/�A�A�Ar&T��operator�group_contentsN)�	_has_args�boolrr�comma_op�
self_group�clause_expr)rI�clauses�kwargs�argss`   r'�__init__zFunctionElement.__init__�sf��� B�A�A�A��A�A�A����5�4��:�:���%�?C�Y�'��
�
�
�
�*�,�,�	
���r&c�0�|�|||��Sr")�_execute_function)rI�
connection�multiparams�paramss    r'�_execute_on_connectionz&FunctionElement._execute_on_connection�s���+�+�D�+�v�F�F�Fr&c�F�t|�d����S)a?The set of columns exported by this :class:`.FunctionElement`.

        Function objects currently have no result column names built in;
        this method returns a single-element column collection with
        an anonymously named column.

        An interim approach to providing named columns for a function
        as a FROM clause is to build a :func:`_expression.select` with the
        desired columns::

            from sqlalchemy.sql import column

            stmt = select([column('x'), column('y')]).\
                select_from(func.myfunction())


        N)r�label�rIs r'�columnszFunctionElement.columns�s��& ��
�
�4� 0� 0�1�1�1r&c��|jjS)z}Return the underlying :class:`.ClauseList` which contains
        the arguments for this :class:`.FunctionElement`.

        )rR�elementr_s r'rSzFunctionElement.clauses�s����'�'r&Nc�*�t|||||���S)a�Produce an OVER clause against this function.

        Used against aggregate or so-called "window" functions,
        for database backends that support window functions.

        The expression::

            func.row_number().over(order_by='x')

        is shorthand for::

            from sqlalchemy import over
            over(func.row_number(), order_by='x')

        See :func:`_expression.over` for a full description.

        )�partition_by�order_by�rows�range_r)rIrdrerfrgs     r'�overzFunctionElement.over�s*��$��%����
�
�
�	
r&c��t|g|�R�S)axProduce a WITHIN GROUP (ORDER BY expr) clause against this function.

        Used against so-called "ordered set aggregate" and "hypothetical
        set aggregate" functions, including :class:`.percentile_cont`,
        :class:`.rank`, :class:`.dense_rank`, etc.

        See :func:`_expression.within_group` for a full description.

        .. versionadded:: 1.1


        r)rIres  r'�within_groupzFunctionElement.within_group�s���4�+�(�+�+�+�+r&c�$�|s|St|g|�R�S)a�Produce a FILTER clause against this function.

        Used against aggregate and window functions,
        for database backends that support the "FILTER" clause.

        The expression::

            func.count(1).filter(True)

        is shorthand for::

            from sqlalchemy import funcfilter
            funcfilter(func.count(1), True)

        .. versionadded:: 1.0.0

        .. seealso::

            :class:`.FunctionFilter`

            :func:`.funcfilter`


        r)rI�	criterions  r'�filterzFunctionElement.filter�s'��2�	��K��d�/�Y�/�/�/�/r&c�$�t|||��S)ai
Interpret this expression as a boolean comparison between two values.

        A hypothetical SQL function "is_equal()" which compares to values
        for equality would be written in the Core expression language as::

            expr = func.is_equal("a", "b")

        If "is_equal()" above is comparing "a" and "b" for equality, the
        :meth:`.FunctionElement.as_comparison` method would be invoked as::

            expr = func.is_equal("a", "b").as_comparison(1, 2)

        Where above, the integer value "1" refers to the first argument of the
        "is_equal()" function and the integer value "2" refers to the second.

        This would create a :class:`.BinaryExpression` that is equivalent to::

            BinaryExpression("a", "b", operator=op.eq)

        However, at the SQL level it would still render as
        "is_equal('a', 'b')".

        The ORM, when it loads a related object or collection, needs to be able
        to manipulate the "left" and "right" sides of the ON clause of a JOIN
        expression. The purpose of this method is to provide a SQL function
        construct that can also supply this information to the ORM, when used
        with the :paramref:`_orm.relationship.primaryjoin` parameter.
        The return
        value is a containment object called :class:`.FunctionAsBinary`.

        An ORM example is as follows::

            class Venue(Base):
                __tablename__ = 'venue'
                id = Column(Integer, primary_key=True)
                name = Column(String)

                descendants = relationship(
                    "Venue",
                    primaryjoin=func.instr(
                        remote(foreign(name)), name + "/"
                    ).as_comparison(1, 2) == 1,
                    viewonly=True,
                    order_by=name
                )

        Above, the "Venue" class can load descendant "Venue" objects by
        determining if the name of the parent Venue is contained within the
        start of the hypothetical descendant value's name, e.g. "parent1" would
        match up to "parent1/child1", but not to "parent2/child1".

        Possible use cases include the "materialized path" example given above,
        as well as making use of special SQL functions such as geometric
        functions to create join conditions.

        :param left_index: the integer 1-based index of the function argument
         that serves as the "left" side of the expression.
        :param right_index: the integer 1-based index of the function argument
         that serves as the "right" side of the expression.

        .. versionadded:: 1.3

        )�FunctionAsBinary)rI�
left_index�right_indexs   r'�
as_comparisonzFunctionElement.as_comparisons��@ ��j�+�>�>�>r&c��|jjSr")rS�
_from_objectsr_s r'rtzFunctionElement._from_objectsEs
���|�)�)r&c��|jfSr")rR)rIrTs  r'�get_childrenzFunctionElement.get_childrenIs��� �"�"r&c��||jfi|��|_|���tj�|��dSr")rR�_reset_exportedrBrS�_reset)rI�clone�kws   r'�_copy_internalszFunctionElement._copy_internalsLsN�� �5��!1�8�8�R�8�8�����������&�&�t�,�,�,�,�,r&c��dS)aFor types that define their return type as based on the criteria
        within a WITHIN GROUP (ORDER BY) expression, called by the
        :class:`.WithinGroup` construct.

        Returns None by default, in which case the function's normal ``.type``
        is used.

        Nr%)rIrjs  r'�within_group_typez!FunctionElement.within_group_typeQs	���tr&c�,�tj||��S)ajProduce a :class:`_expression.Alias` construct against this
        :class:`.FunctionElement`.

        This construct wraps the function in a named alias which
        is suitable for the FROM clause, in the style accepted for example
        by PostgreSQL.

        e.g.::

            from sqlalchemy.sql import column

            stmt = select([column('data_view')]).\
                select_from(SomeTable).\
                select_from(func.unnest(SomeTable.data).alias('data_view')
            )

        Would produce:

        .. sourcecode:: sql

            SELECT data_view
            FROM sometable, unnest(sometable.data) AS data_view

        .. versionadded:: 0.9.8 The :meth:`.FunctionElement.alias` method
           is now supported.  Previously, this method's behavior was
           undefined and did not behave consistently across versions.

        )r�
_construct)rIr*�flats   r'�aliaszFunctionElement.alias]s��<���d�+�+�+r&c�X�t|g��}|jr|jdi|j��}|S)z�Produce a :func:`_expression.select` construct
        against this :class:`.FunctionElement`.

        This is shorthand for::

            s = select([function_element])

        r%)r�_execution_options�execution_options)rI�ss  r'�selectzFunctionElement.select}s<��
�D�6�N�N���"�	?�#��#�>�>�d�&=�>�>�A��r&c�r�|���������S)a�Execute this :class:`.FunctionElement` against an embedded
        'bind' and return a scalar value.

        This first calls :meth:`~.FunctionElement.select` to
        produce a SELECT construct.

        Note that :class:`.FunctionElement` can be passed to
        the :meth:`.Connectable.scalar` method of :class:`_engine.Connection`
        or :class:`_engine.Engine`.

        )r��execute�scalarr_s r'r�zFunctionElement.scalar�s*���{�{�}�}�$�$�&�&�-�-�/�/�/r&c�N�|������S)agExecute this :class:`.FunctionElement` against an embedded
        'bind'.

        This first calls :meth:`~.FunctionElement.select` to
        produce a SELECT construct.

        Note that :class:`.FunctionElement` can be passed to
        the :meth:`.Connectable.execute` method of :class:`_engine.Connection`
        or :class:`_engine.Engine`.

        )r�r�r_s r'r�zFunctionElement.execute�s���{�{�}�}�$�$�&�&�&r&c�6�td|||jd|���S)NT)�_compared_to_operator�_compared_to_type�unique�type_)r�type�rIrL�objr�s    r'�_bind_paramzFunctionElement._bind_param�s-�����"*�"�i���

�
�
�	
r&c����|tjur.t|jtj��rt
|��Stt|���	|���S)N)�against)
r�getitem�
isinstancer�r�ARRAYr�superrBrQ)rIr��	__class__s  �r'rQzFunctionElement.self_group�sZ���
�i�'�'�'�J��I�x�~�-
�-
�'��D�>�>�!���$�/�/�:�:�7�:�K�K�Kr&)NNNN)NFr")�__name__�
__module__�__qualname__�__doc__�packagenamesrNrVr\�propertyr`r�memoized_propertyrSrhrjrmrrrtrvr
r|r~r�r�r�r�r�rQ�
__classcell__�r�s@r'rBrBrs���������� �L��I����,G�G�G��2�2��X�2�(
��(�(���(�
�
�
�
�4
,�
,�
,�0�0�0�:@?�@?�@?�D�*�*��X�*�#�#�#�%+�-�-�-�-�

�
�
�,�,�,�,�@���0�0�0�'�'�'�
�
�
�
�
L�
L�
L�
L�
L�
L�
L�
L�
L�
Lr&rBc���eZdZ�fd�Zed���Zejd���Zed���Zejd���Z�fd�Z�xZ	S)roc���|jj|dz
}|jj|dz
}||_||_||_t	t
|���||tjtj
���dS)Nr)r�)rS�sql_functionrprqr�rorVr�function_as_comparison_opr�BOOLEANTYPE)rIr;rprq�left�rightr�s      �r'rVzFunctionAsBinary.__init__�s�����z�!�*�q�.�1���
�"�;��?�3�����$���&���
���%�%�.�.����/��&�		/�	
�	
�	
�	
�	
r&c�@�|jjj|jdz
S�Nr�r�rSrpr_s r'r�zFunctionAsBinary.left�s��� �(�0���1�1D�E�Er&c�>�||jjj|jdz
<dSr�r��rI�values  r'r�zFunctionAsBinary.left�s"��AF���!�)�$�/�A�*=�>�>�>r&c�@�|jjj|jdz
Sr��r�rSrqr_s r'r�zFunctionAsBinary.right�s��� �(�0��1A�A�1E�F�Fr&c�>�||jjj|jdz
<dSr�r�r�s  r'r�zFunctionAsBinary.right�s#��BG���!�)�$�*:�Q�*>�?�?�?r&c���|�d��}||jfi|��|_tt|��jdi|��dS)Nrzr%)�popr�r�ror|)rIr{rzr�s   �r'r|z FunctionAsBinary._copy_internals�sY������w����!�E�$�"3�:�:�r�:�:���5����%�%�5�;�;��;�;�;�;�;r&)
r�r�r�rVr�r��setterr�r|r�r�s@r'roro�s��������

�

�

�

�

��F�F��X�F�
�[�G�G��[�G��G�G��X�G��\�H�H��\�H�<�<�<�<�<�<�<�<�<r&roc�$�eZdZdZd�Zd�Zd�ZdS)�_FunctionGeneratora�Generate SQL function expressions.

    :data:`.func` is a special object instance which generates SQL
    functions based on name-based attributes, e.g.::

        >>> print(func.count(1))
        count(:param_1)

    The returned object is an instance of :class:`.Function`, and  is a
    column-oriented SQL element like any other, and is used in that way::

        >>> print(select([func.count(table.c.id)]))
        SELECT count(sometable.id) FROM sometable

    Any name can be given to :data:`.func`. If the function name is unknown to
    SQLAlchemy, it will be rendered exactly as is. For common SQL functions
    which SQLAlchemy is aware of, the name may be interpreted as a *generic
    function* which will be compiled appropriately to the target database::

        >>> print(func.current_timestamp())
        CURRENT_TIMESTAMP

    To call functions which are present in dot-separated packages,
    specify them in the same manner::

        >>> print(func.stats.yield_curve(5, 10))
        stats.yield_curve(:yield_curve_1, :yield_curve_2)

    SQLAlchemy can be made aware of the return type of functions to enable
    type-specific lexical and result-based behavior. For example, to ensure
    that a string-based function returns a Unicode value and is similarly
    treated as a string in expressions, specify
    :class:`~sqlalchemy.types.Unicode` as the type:

        >>> print(func.my_string(u'hi', type_=Unicode) + ' ' +
        ...       func.my_string(u'there', type_=Unicode))
        my_string(:my_string_1) || :my_string_2 || my_string(:my_string_3)

    The object returned by a :data:`.func` call is usually an instance of
    :class:`.Function`.
    This object meets the "column" interface, including comparison and labeling
    functions.  The object can also be passed the :meth:`~.Connectable.execute`
    method of a :class:`_engine.Connection` or :class:`_engine.Engine`,
    where it will be
    wrapped inside of a SELECT statement first::

        print(connection.execute(func.current_timestamp()).scalar())

    In a few exception cases, the :data:`.func` accessor
    will redirect a name to a built-in expression such as :func:`.cast`
    or :func:`.extract`, as these names have well-known meaning
    but are not exactly the same as "functions" from a SQLAlchemy
    perspective.

    Functions which are interpreted as "generic" functions know how to
    calculate their return type automatically. For a listing of known generic
    functions, see :ref:`generic_functions`.

    .. note::

        The :data:`.func` construct has only limited support for calling
        standalone "stored procedures", especially those with special
        parameterization concerns.

        See the section :ref:`stored_procedures` for details on how to use
        the DBAPI-level ``callproc()`` method for fully traditional stored
        procedures.

    .. seealso::

        :ref:`coretutorial_functions` - in the Core Tutorial

        :class:`.Function`

    c�"�g|_||_dSr")�_FunctionGenerator__names�opts)rIr�s  r'rVz_FunctionGenerator.__init__1s�������	�	�	r&c� �|�d��r+	|j|S#t$rt|���wxYw|�d��r
|dd�}tdi|j��}t|j��|gz|_|S)N�__�_r.���r%)	�
startswith�__dict__�KeyError�AttributeError�endswithr�r�r7r�)rIr*�fs   r'�__getattr__z_FunctionGenerator.__getattr__5s����?�?�4� � �	�
+��}�T�*�*���
+�
+�
+�$�T�*�*�*�
+�����]�]�3�
�
�	���"��:�D��+�+���+�+�����&�&�$��/��	��s�$�>c�H�|j���}|�|��t|j��}|dkr|j\}}n|dkrd|jd}}nd}|��t
|�|�����}|turGt|}|�|������|��}|�||i|��St|jdg|�Rd|jdd�i|��S)Nr rr,r.r�r�)r��copy�update�lenr�r/�getr2r3r0�Function)	rIrHrT�o�tokensr<�fname�funcr>s	         r'�__call__z_FunctionGenerator.__call__Cs/���I�N�N����	��������T�\�"�"���Q�;�;�!�\�N�G�U�U�
�q�[�[�'���a��U�G�G��G����W�%�)�)�%�+�+�-�-�8�8�D���&�&�%=�g�%F�"�)�-�-�e�k�k�m�m�<�<�@�@��G�G�����t�Q�}�!�}�}�$���L���
�@A�
�
�
�+/�<��"��+=�
�EF�
�
�	
r&N)r�r�r�r�rVr�r�r%r&r'r�r��sN������J�J�X������
�
�
�
�
r&r�F)�groupc�$�eZdZdZdZd�Zdd�ZdS)r�a�Describe a named SQL function.

    The :class:`.Function` object is typically generated from the
    :data:`.func` generation object.


    :param \*clauses: list of column expressions that form the arguments
     of the SQL function call.

    :param type\_: optional :class:`.TypeEngine` datatype object that will be
     used as the return value of the column expression generated by this
     function call.

    :param packagenames: a string which indicates package prefix names
     to be prepended to the function name when the SQL is generated.
     The :data:`.func` generator creates these when it is called using
     dotted format, e.g.::

        func.mypackage.some_function(col1, col2)


    .. seealso::

        :ref:`coretutorial_functions`

        :data:`.func` - namespace which produces registered or ad-hoc
        :class:`.Function` instances.

        :class:`.GenericFunction` - allows creation of registered function
        types.

    �functionc��|�dd��pg|_||_|�dd��|_tj|�dd����|_tj	|g|�Ri|��dS)z�Construct a :class:`.Function`.

        The :data:`.func` construct is normally used to construct
        new :class:`.Function` instances.

        r�N�bindr�)
r�r�r*r��_bindr�to_instancer�rBrV)rIr*rSr{s    r'rVzFunction.__init__�s����F�F�>�4�8�8�>�B�����	��V�V�F�D�)�)��
��(������)>�)>�?�?��	�� ��6��6�6�6�2�6�6�6�6�6r&Nc�@�t|j|||j|d���S)NT)r�r�r�r�)rr*r�r�s    r'r�zFunction._bind_param�s/����I��"*�"�i���

�
�
�	
r&r")r�r�r�r��__visit_name__rVr�r%r&r'r�r�dsI��������B �N�7�7�7�
�
�
�
�
�
r&r�c���eZdZ�fd�Z�xZS)�_GenericMetac���tj|jvr�|�d|��x|_}|�d|��x|_}|�dd��}d|vr
|d|_t|dd��|_	|j	rt|||��nd|_	tt|���
|||��dS)Nr*r:r<r,�__return_type__�	_registerT)r�	Annotated�__mro__r�r*r:r�r��getattrr�r@r�r�rV)�cls�clsname�bases�clsdictr*r:r<r�s       �r'rVz_GenericMeta.__init__�s������s�{�2�2�%�k�k�&�'�:�:�:�C�H�t�*1�+�+�l�D�*I�*I�I�C�N�Z��k�k�)�Z�8�8�G� �G�+�+�"�#4�5���$�C��d�;�;�C�M��}�
%�!�*�c�7�;�;�;�;�!%��
�
�l�C� � �)�)�'�5�'�B�B�B�B�Br&)r�r�r�rVr�r�s@r'r�r��sA�������C�C�C�C�C�C�C�C�Cr&r�c� �eZdZdZdZdZd�ZdS)�GenericFunctiona�Define a 'generic' function.

    A generic function is a pre-established :class:`.Function`
    class that is instantiated automatically when called
    by name from the :data:`.func` attribute.    Note that
    calling any name from :data:`.func` has the effect that
    a new :class:`.Function` instance is created automatically,
    given that name.  The primary use case for defining
    a :class:`.GenericFunction` class is so that a function
    of a particular name may be given a fixed return type.
    It can also include custom argument parsing schemes as well
    as additional methods.

    Subclasses of :class:`.GenericFunction` are automatically
    registered under the name of the class.  For
    example, a user-defined function ``as_utc()`` would
    be available immediately::

        from sqlalchemy.sql.functions import GenericFunction
        from sqlalchemy.types import DateTime

        class as_utc(GenericFunction):
            type = DateTime

        print(select([func.as_utc()]))

    User-defined generic functions can be organized into
    packages by specifying the "package" attribute when defining
    :class:`.GenericFunction`.   Third party libraries
    containing many functions may want to use this in order
    to avoid name conflicts with other systems.   For example,
    if our ``as_utc()`` function were part of a package
    "time"::

        class as_utc(GenericFunction):
            type = DateTime
            package = "time"

    The above function would be available from :data:`.func`
    using the package name ``time``::

        print(select([func.time.as_utc()]))

    A final option is to allow the function to be accessed
    from one name in :data:`.func` but to render as a different name.
    The ``identifier`` attribute will override the name used to
    access the function as loaded from :data:`.func`, but will retain
    the usage of ``name`` as the rendered name::

        class GeoBuffer(GenericFunction):
            type = Geometry
            package = "geo"
            name = "ST_Buffer"
            identifier = "buffer"

    The above function will render as follows::

        >>> print(func.geo.buffer())
        ST_Buffer()

    The name will be rendered as is, however without quoting unless the name
    contains special characters that require quoting.  To force quoting
    on or off for the name, use the :class:`.sqlalchemy.sql.quoted_name`
    construct::

        from sqlalchemy.sql import quoted_name

        class GeoBuffer(GenericFunction):
            type = Geometry
            package = "geo"
            name = quoted_name("ST_Buffer", True)
            identifier = "buffer"

    The above function will render as::

        >>> print(func.geo.buffer())
        "ST_Buffer"()

    .. versionadded:: 1.3.13  The :class:`.quoted_name` construct is now
       recognized for quoting when used with the "name" attribute of the
       object, so that quoting can be forced on or off for the function
       name.


    TFc���|�dd��}|��fd�|D��}�jpt|���_g�_|�dd���_t
|tjdd���	���_
tj|�dd��pt�dd�����_dS)N�_parsed_argsc�:��g|]}t|�j����Sr%rErFs  �r'rJz,GenericFunction.__init__.<locals>.<listcomp>s&���I�I�I�q�,�Q��	�:�:�I�I�Ir&r�TrKr�r�)r�rNrOr�r�r�rrrPrQrRrr�r�r�)rIrUrT�parsed_argss`   r'rVzGenericFunction.__init__s�����j�j���6�6����I�I�I�I�D�I�I�I�K���<�4��+<�+<�������Z�Z���-�-��
�%�?J�Y�'��
�
�
�
�*�,�,�	
���(��J�J�w��%�%�D���v�t�)D�)D�
�
��	�	�	r&N)r�r�r�r��coerce_argumentsr�rVr%r&r'r�r��s=������T�T�l���I�
�
�
�
�
r&r��cast�extractc�P�eZdZdZej��ZdZd�Ze	d���Z
dS)�
next_valueaRepresent the 'next value', given a :class:`.Sequence`
    as its single argument.

    Compiles into the appropriate function on each backend,
    or will raise NotImplementedError if used on a backend
    that does not provide support for sequences.

    c��t|tj��s
Jd���|�dd��|_||_dS)Nz0next_value() accepts a Sequence object as input.r�)r�r�Sequencer�r��sequence)rI�seqr{s   r'rVznext_value.__init__2sT������
�
�	>�	>�=�	>�	>�
��V�V�F�D�)�)��
���
�
�
r&c��gSr"r%r_s r'rtznext_value._from_objects9s���	r&N)r�r�r�r�r�Integerr�r*rVr�rtr%r&r'r�r�%s_���������8����D��D��������X���r&r�c��eZdZd�ZdS)�AnsiFunctionc�0�tj|g|�Ri|��dSr"�r�rV)rIrUrTs   r'rVzAnsiFunction.__init__?s)��� ��7��7�7�7��7�7�7�7�7r&N)r�r�r�rVr%r&r'r�r�>s#������8�8�8�8�8r&r�c�"��eZdZdZ�fd�Z�xZS)�ReturnTypeFromArgszADefine a function whose return type is the same as its arguments.c�����fd�|D��}|�dt|����||d<tt���j|i|��dS)Nc�:��g|]}t|�j����Sr%rErFs  �r'rJz/ReturnTypeFromArgs.__init__.<locals>.<listcomp>Gs&���>�>�>�A�!�!�T�Y�/�/�>�>�>r&r�r�)�
setdefaultr
r�r�rV)rIrUrTr�s`  �r'rVzReturnTypeFromArgs.__init__Fsn����>�>�>�>��>�>�>�����'�?�4�#8�#8�9�9�9�!%��~��0�� �$�'�'�0�$�A�&�A�A�A�A�Ar&)r�r�r�r�rVr�r�s@r'r�r�CsG�������K�K�B�B�B�B�B�B�B�B�Br&r�c��eZdZdZdS)�coalesceTN�r�r�r�rNr%r&r'rrM��������I�I�Ir&rc��eZdZdS)�maxN�r�r�r�r%r&r'rrQ��������Dr&rc��eZdZdS)�minNrr%r&r'rrUr	r&rc��eZdZdS)�sumNrr%r&r'r
r
Yr	r&r
c��eZdZejZdS)�nowN�r�r�r�r�DateTimer�r%r&r'rr]���������D�D�Dr&rc��eZdZejZdS)�concatN�r�r�r�r�Stringr�r%r&r'rra��������?�D�D�Dr&rc�"�eZdZejZd�ZdS)�char_lengthc�,�tj||fi|��dSr"r�)rI�argrTs   r'rVzchar_length.__init__hs#��� ��s�5�5�f�5�5�5�5�5r&N)r�r�r�rr�r�rVr%r&r'rres+��������D�6�6�6�6�6r&rc��eZdZdZdS)�randomTNrr%r&r'rrlrr&rc�2��eZdZdZejZd�fd�	Z�xZS)�counta�The ANSI COUNT aggregate function.  With no arguments,
    emits COUNT \*.

    E.g.::

        from sqlalchemy import func
        from sqlalchemy import select
        from sqlalchemy import table, column

        my_table = table('some_table', column('id'))

        stmt = select([func.count()]).select_from(my_table)

    Executing ``stmt`` would emit::

        SELECT count(*) AS count_1
        FROM some_table


    Nc�l��|�td��}tt|��j|fi|��dS)N�*)rr�rrV)rI�
expressionrTr�s   �r'rVzcount.__init__�sA�����'��,�,�J�#��e�T���#�J�9�9�&�9�9�9�9�9r&r")	r�r�r�r�rr�r�rVr�r�s@r'rrpsQ���������(��D�:�:�:�:�:�:�:�:�:�:r&rc��eZdZejZdS)�current_dateN)r�r�r�r�Dater�r%r&r'r$r$���������=�D�D�Dr&r$c��eZdZejZdS)�current_timeN)r�r�r�r�Timer�r%r&r'r(r(�r&r&r(c��eZdZejZdS)�current_timestampNrr%r&r'r+r+�rr&r+c��eZdZejZdS)�current_userNrr%r&r'r-r-�rr&r-c��eZdZejZdS)�	localtimeNrr%r&r'r/r/�rr&r/c��eZdZejZdS)�localtimestampNrr%r&r'r1r1�rr&r1c��eZdZejZdS)�session_userNrr%r&r'r3r3�rr&r3c��eZdZejZdS)�sysdateNrr%r&r'r5r5�rr&r5c��eZdZejZdS)�userNrr%r&r'r7r7�rr&r7c�0��eZdZdZejZ�fd�Z�xZS)�	array_agga�Support for the ARRAY_AGG function.

    The ``func.array_agg(expr)`` construct returns an expression of
    type :class:`_types.ARRAY`.

    e.g.::

        stmt = select([func.array_agg(table.c.values)[2:5]])

    .. versionadded:: 1.1

    .. seealso::

        :func:`_postgresql.array_agg` - PostgreSQL-specific version that
        returns :class:`_postgresql.ARRAY`, which has PG-specific operators
        added.

    c�,��d�|D��}|�dtj��}d|vr=t|��}t	|tj��r||d<n||��|d<||d<tt|��j|i|��dS)Nc�,�g|]}t|����Sr%r)rGrHs  r'rJz&array_agg.__init__.<locals>.<listcomp>�s!��3�3�3��!�!�$�$�3�3�3r&�_default_array_typer�r�)r�rr�r
r�r�r9rV)rIrUrT�default_array_type�type_from_argsr�s     �r'rVzarray_agg.__init__�s����3�3�d�3�3�3��#�Z�Z�(=�x�~�N�N���&� � �,�T�2�2�N��.�(�.�9�9�
E�"0��w���"4�"4�^�"D�"D��w��!%��~��'��i����'��8��8�8�8�8�8r&)	r�r�r�r�rr�r�rVr�r�s@r'r9r9�sK���������&�>�D�9�9�9�9�9�9�9�9�9r&r9c��eZdZdZdZd�ZdS)�
OrderedSetAggz�Define a function where the return type is based on the sort
    expression type as defined by the expression passed to the
    :meth:`.FunctionElement.within_group` method.Fc���|jj}tj|j��}|jr7t
|j��dkrtj	|dj
��S|dj
S)Nrr.)rRrb�sqlutil�unwrap_order_byre�array_for_multi_clauser�rSrr�r�)rIrj�func_clausesres    r'r~zOrderedSetAgg.within_group_type�sd���'�/���*�<�+@�A�A���&�	$�3�|�/C�+D�+D�q�+H�+H��>�(�1�+�"2�3�3�3��A�;�#�#r&N)r�r�r�r�rDr~r%r&r'r@r@�s5������5�5�#��$�$�$�$�$r&r@c��eZdZdZdS)�modea*Implement the ``mode`` ordered-set aggregate function.

    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.

    The return type of this function is the same as the sort expression.

    .. versionadded:: 1.1

    N)r�r�r�r�r%r&r'rGrG�s������	�	�	�	r&rGc��eZdZdZdZdS)�percentile_conta�Implement the ``percentile_cont`` ordered-set aggregate function.

    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.

    The return type of this function is the same as the sort expression,
    or if the arguments are an array, an :class:`_types.ARRAY` of the sort
    expression's type.

    .. versionadded:: 1.1

    TN�r�r�r�r�rDr%r&r'rIrI��"��������"���r&rIc��eZdZdZdZdS)�percentile_disca�Implement the ``percentile_disc`` ordered-set aggregate function.

    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.

    The return type of this function is the same as the sort expression,
    or if the arguments are an array, an :class:`_types.ARRAY` of the sort
    expression's type.

    .. versionadded:: 1.1

    TNrJr%r&r'rMrMrKr&rMc�0�eZdZdZej��ZdS)�ranka!Implement the ``rank`` hypothetical-set aggregate function.

    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.

    The return type of this function is :class:`.Integer`.

    .. versionadded:: 1.1

    N�r�r�r�r�rr�r�r%r&r'rOrO�*������	�	��8����D�D�Dr&rOc�0�eZdZdZej��ZdS)�
dense_ranka'Implement the ``dense_rank`` hypothetical-set aggregate function.

    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.

    The return type of this function is :class:`.Integer`.

    .. versionadded:: 1.1

    NrPr%r&r'rSrS$rQr&rSc�0�eZdZdZej��ZdS)�percent_ranka)Implement the ``percent_rank`` hypothetical-set aggregate function.

    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.

    The return type of this function is :class:`.Numeric`.

    .. versionadded:: 1.1

    N�r�r�r�r�r�Numericr�r%r&r'rUrU3rQr&rUc�0�eZdZdZej��ZdS)�	cume_dista&Implement the ``cume_dist`` hypothetical-set aggregate function.

    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.

    The return type of this function is :class:`.Numeric`.

    .. versionadded:: 1.1

    NrVr%r&r'rYrYBrQr&rYc��eZdZdZdZdS)�cubeaYImplement the ``CUBE`` grouping operation.

    This function is used as part of the GROUP BY of a statement,
    e.g. :meth:`_expression.Select.group_by`::

        stmt = select(
            [func.sum(table.c.value), table.c.col_1, table.c.col_2]
            ).group_by(func.cube(table.c.col_1, table.c.col_2))

    .. versionadded:: 1.2

    TN�r�r�r�r�rNr%r&r'r[r[Q����������I�I�Ir&r[c��eZdZdZdZdS)�rollupaYImplement the ``ROLLUP`` grouping operation.

    This function is used as part of the GROUP BY of a statement,
    e.g. :meth:`_expression.Select.group_by`::

        stmt = select(
            [func.sum(table.c.value), table.c.col_1, table.c.col_2]
        ).group_by(func.rollup(table.c.col_1, table.c.col_2))

    .. versionadded:: 1.2

    TNr\r%r&r'r_r_ar]r&r_c��eZdZdZdZdS)�
grouping_setsa0Implement the ``GROUPING SETS`` grouping operation.

    This function is used as part of the GROUP BY of a statement,
    e.g. :meth:`_expression.Select.group_by`::

        stmt = select(
            [func.sum(table.c.value), table.c.col_1, table.c.col_2]
        ).group_by(func.grouping_sets(table.c.col_1, table.c.col_2))

    In order to group by multiple sets, use the :func:`.tuple_` construct::

        from sqlalchemy import tuple_

        stmt = select(
            [
                func.sum(table.c.value),
                table.c.col_1, table.c.col_2,
                table.c.col_3]
        ).group_by(
            func.grouping_sets(
                tuple_(table.c.col_1, table.c.col_2),
                tuple_(table.c.value, table.c.col_3),
            )
        )


    .. versionadded:: 1.2

    TNr\r%r&r'raraqs��������:�I�I�Ir&raN)r,)Rr��rrrrrrB�baserr	�elementsr
rr
rrrrrrrrrrr�
selectablerrr�visitorsrr#r$r/r0�symbolr3r@rBro�objectr�r��modifierr�r��with_metaclassr�r�r�r�rrrr
rrrrrr$r(r+r-r/r1r3r5r7r9r@rGrIrMrOrSrUrYr[r_rar%r&r'�<module>rksY	����������������������������������"�"�"�"�"�"�������������'�'�'�'�'�'�%�%�%�%�%�%�&�&�&�&�&�&�#�#�#�#�#�#������� � � � � � �#�#�#�#�#�#�������$�$�$�$�$�$�������$�$�$�$�$�$�������!�!�!�!�!�!�������"�"�"�"�"�"�������#�#�#�#�#�#�������
�D��T�"�"�	�+�4�+�,J�,J�K�K���$�+�	"�	�����?8�?8�?8�?8�DIL�IL�IL�IL�IL�j�-��IL�IL�IL�X
#<�#<�#<�#<�#<�'�#<�#<�#<�Lw
�w
�w
�w
�w
��w
�w
�w
�t�����!�)�����E�*�*�*��:
�:
�:
�:
�:
��:
�:
�:
�zC�C�C�C�C�=�C�C�C�.f
�f
�f
�f
�f
�)�d�)�,��A�A�f
�f
�f
�R��&�$������)�W�%�%�%����������28�8�8�8�8�?�8�8�8�
B�B�B�B�B��B�B�B������!����	�	�	�	�	�
�	�	�	�	�	�	�	�	�
�	�	�	�	�	�	�	�	�
�	�	�	������/���������_����6�6�6�6�6�/�6�6�6������_����:�:�:�:�:�O�:�:�:�:�����<���������<������������������<������������������\���������<���������l���������<����"9�"9�"9�"9�"9��"9�"9�"9�J
$�
$�
$�
$�
$�O�
$�
$�
$� 
�
�
�
�
�=�
�
�
�"�"�"�"�"�m�"�"�"�""�"�"�"�"�m�"�"�"�"�����?������������������?�������������
�
�
�
�
�?�
�
�
� 
�
�
�
�
�_�
�
�
� �����O�����r&

Hacked By AnonymousFox1.0, Coded By AnonymousFox