o
    y¬´\G¢  ã                   @   s¶  d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd	lm	Z	 dd
lm
Z
 ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ejr„ddlmZ neZG dd„ deƒZG dd„ deƒZG dd„ deƒZdd„ Zd d!„ Zd"d#„ Zd$d%„ Z d&d'„ Z!d(d)„ Z"d*d+„ Z#d,d-„ Z$d.d/„ Z%d0d1„ Z&d2d3„ Z'd�d5d6„Z(d�d7d8„Z)d�d9d:„Z*d�d;d<„Z+d�d>d?„Z,d�d@dA„Z-dBdC„ Z.dDdE„ Z/dFdG„ Z0dHdI„ Z1dJdK„ Z2dLdM„ Z3d‘dNdO„Z4d‘dPdQ„Z5d‘dRdS„Z6d‘dTdU„Z7d‘dVdW„Z8d‘dXdY„Z9dZd[„ Z:d\d]„ Z;d^d_„ Z<d`da„ Z=dbdc„ Z>ddde„ Z?dfdg„ Z@dhdi„ ZAdjdk„ ZBdldm„ ZCdndo„ ZDdpdq„ ZEeeeehZFeeeeee
e,e(e$e%e"e#hZGdrds„ ZHdtdu„ ZIdvdw„ ZJdxdy„ ZKe	e e!eefZLdzd{„ ZMeeee
eee
eiZNd|d}„ ZOeF Pe?eeg¡ Qeeg¡ZReR PeeDeEg¡ZS	 ejTd~dd€�ZUejTd�d‚d€�ZVejTdƒd„d€�ZWi ed…“e1d…“e2d…“ed…“eDd…“eEd…“ed†“ed†“ed†“ed†“ed†“ed‡“ed‡“e?dˆ“e:d‰“e;d‰“e*d‰“i e+d‰“e(d‰“e)d‰“e.d‰“e/d‰“e$d‰“e%d‰“ed‰“ed‰“e"d‰“e#d‰“e=d‰“e>d‰“ed‰“ed‰“ed‰“e
d‰“¥i e,d‰“e-d‰“e0d‰“e	d‰“e d‰“e!d‰“edŠ“ed“e<d‹“e@dŠ“eAdŠ“e&dŒ“ed‹“ed“eUd“eVeV“eWeW“¥ZXd�dŽ„ ZYd4S )’z*Defines operators used in SQL expressions.é    )Úadd)Úand_)Úcontains)Úeq)Úge)Úgetitem)Úgt)Úinv)Úle)Úlshift)Últ)Úmod)Úmul)Úne)Úneg)Úor_)Úrshift)Úsub)Útruedivé   )Úutil)Údivc                   @   sR   e Zd ZdZdZdd„ Zdd„ Zdd„ Z	ddd„Zddd„Z	dd„ Z
dd„ ZdS )Ú	OperatorsaÒ  Base of comparison and logical operators.

    Implements base methods
    :meth:`~sqlalchemy.sql.operators.Operators.operate` and
    :meth:`~sqlalchemy.sql.operators.Operators.reverse_operate`, as well as
    :meth:`~sqlalchemy.sql.operators.Operators.__and__`,
    :meth:`~sqlalchemy.sql.operators.Operators.__or__`,
    :meth:`~sqlalchemy.sql.operators.Operators.__invert__`.

    Usually is used via its most common subclass
    :class:`.ColumnOperators`.

    © c                 C   ó   |   t|¡S )a.  Implement the ``&`` operator.

        When used with SQL expressions, results in an
        AND operation, equivalent to
        :func:`~.expression.and_`, that is::

            a & b

        is equivalent to::

            from sqlalchemy import and_
            and_(a, b)

        Care should be taken when using ``&`` regarding
        operator precedence; the ``&`` operator has the highest precedence.
        The operands should be enclosed in parenthesis if they contain
        further sub expressions::

            (a == 2) & (b == 4)

        )Úoperater   ©ÚselfÚotherr   r   úJ/var/www/html/env/lib/python3.10/site-packages/sqlalchemy/sql/operators.pyÚ__and__;   ó   zOperators.__and__c                 C   r   )a*  Implement the ``|`` operator.

        When used with SQL expressions, results in an
        OR operation, equivalent to
        :func:`~.expression.or_`, that is::

            a | b

        is equivalent to::

            from sqlalchemy import or_
            or_(a, b)

        Care should be taken when using ``|`` regarding
        operator precedence; the ``|`` operator has the highest precedence.
        The operands should be enclosed in parenthesis if they contain
        further sub expressions::

            (a == 2) | (b == 4)

        )r   r   r   r   r   r   Ú__or__S   r!   zOperators.__or__c                 C   ó
   |   t¡S )a  Implement the ``~`` operator.

        When used with SQL expressions, results in a
        NOT operation, equivalent to
        :func:`~.expression.not_`, that is::

            ~a

        is equivalent to::

            from sqlalchemy import not_
            not_(a)

        )r   r	   ©r   r   r   r   Ú
__invert__k   s   
zOperators.__invert__r   FNc                    s    t ||||ƒ‰ ‡ ‡fdd„}|S )a!  produce a generic operator function.

        e.g.::

          somecolumn.op("*")(5)

        produces::

          somecolumn * 5

        This function can also be used to make bitwise operators explicit. For
        example::

          somecolumn.op('&')(0xff)

        is a bitwise AND of the value in ``somecolumn``.

        :param operator: a string which will be output as the infix operator
          between this element and the expression passed to the
          generated function.

        :param precedence: precedence to apply to the operator, when
         parenthesizing expressions.  A lower number will cause the expression
         to be parenthesized when applied against another operator with
         higher precedence.  The default value of ``0`` is lower than all
         operators except for the comma (``,``) and ``AS`` operators.
         A value of 100 will be higher or equal to all operators, and -100
         will be lower than or equal to all operators.

        :param is_comparison: if True, the operator will be considered as a
         "comparison" operator, that is which evaluates to a boolean
         true/false value, like ``==``, ``>``, etc.  This flag should be set
         so that ORM relationships can establish that the operator is a
         comparison operator when used in a custom join condition.

         .. versionadded:: 0.9.2 - added the
            :paramref:`.Operators.op.is_comparison` flag.

        :param return_type: a :class:`.TypeEngine` class or object that will
          force the return type of an expression produced by this operator
          to be of that type.   By default, operators that specify
          :paramref:`.Operators.op.is_comparison` will resolve to
          :class:`.Boolean`, and those that do not will be of the same
          type as the left-hand operand.

          .. versionadded:: 1.2.0b3 - added the
             :paramref:`.Operators.op.return_type` argument.

        .. seealso::

            :ref:`types_operators`

            :ref:`relationship_custom_operator`

        c                    s
   ˆ ˆ| ƒS ©Nr   )r   ©Úoperatorr   r   r   Úagainst¸   ó   
zOperators.op.<locals>.against)Ú	custom_op)r   ÚopstringÚ
precedenceÚis_comparisonÚreturn_typer)   r   r'   r   Úop|   s   :zOperators.opc                 C   s   | j ||dd�S )a+  Return a custom boolean operator.

        This method is shorthand for calling
        :meth:`.Operators.op` and passing the
        :paramref:`.Operators.op.is_comparison`
        flag with True.

        .. versionadded:: 1.2.0b3

        .. seealso::

            :meth:`.Operators.op`

        T)r-   r.   ©r0   )r   r,   r-   r   r   r   Úbool_op½   s   zOperators.bool_opc                 O   ó   t t|ƒƒ‚)a3  Operate on an argument.

        This is the lowest level of operation, raises
        :class:`NotImplementedError` by default.

        Overriding this on a subclass can allow common
        behavior to be applied to all operations.
        For example, overriding :class:`.ColumnOperators`
        to apply ``func.lower()`` to the left and right
        side::

            class MyComparator(ColumnOperators):
                def operate(self, op, other):
                    return op(func.lower(self), func.lower(other))

        :param op:  Operator callable.
        :param \*other: the 'other' side of the operation. Will
         be a single scalar for most operations.
        :param \**kwargs: modifiers.  These may be passed by special
         operators such as :meth:`ColumnOperators.contains`.


        ©ÚNotImplementedErrorÚstr©r   r0   r   Úkwargsr   r   r   r   Î   s   zOperators.operatec                 K   r3   )zXReverse operate on an argument.

        Usage is the same as :meth:`operate`.

        r4   r7   r   r   r   Úreverse_operateè   ó   zOperators.reverse_operate)r   FN)r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r    r"   r%   r0   r2   r   r9   r   r   r   r   r   *   s    
ÿ
Ar   c                   @   s@   e Zd ZdZd Z 					ddd„Zdd„ Zd	d
„ Zdd„ ZdS )r+   aÄ  Represent a 'custom' operator.

    :class:`.custom_op` is normally instantiated when the
    :meth:`.Operators.op` or :meth:`.Operators.bool_op` methods
    are used to create a custom operator callable.  The class can also be
    used directly when programmatically constructing expressions.   E.g.
    to represent the "factorial" operation::

        from sqlalchemy.sql import UnaryExpression
        from sqlalchemy.sql import operators
        from sqlalchemy import Numeric

        unary = UnaryExpression(table.c.somecolumn,
                modifier=operators.custom_op("!"),
                type_=Numeric)


    .. seealso::

        :meth:`.Operators.op`

        :meth:`.Operators.bool_op`

    r   FNc                 C   s<   || _ || _|| _|| _|| _|r| |¡| _d S d | _d S r&   )r,   r-   r.   Únatural_self_precedentÚeager_groupingÚ_to_instancer/   )r   r,   r-   r.   r/   r@   rA   r   r   r   Ú__init__  s   	ÿÿzcustom_op.__init__c                 C   s   t |tƒo
|j| jkS r&   )Ú
isinstancer+   r,   r   r   r   r   Ú__eq__  s   zcustom_op.__eq__c                 C   s   t | ƒS r&   )Úidr$   r   r   r   Ú__hash__"  ó   zcustom_op.__hash__c                 K   s   |j | |fi |¤ŽS r&   )r   )r   ÚleftÚrightÚkwr   r   r   Ú__call__%  s   zcustom_op.__call__)r   FNFF)r;   r<   r=   r>   rC   rE   rG   rL   r   r   r   r   r+   ñ   s    
ùr+   c                   @   s¢  e Zd ZdZdZdZ	 dd„ Zdd„ Zej	Z	dd	„ Z
d
d„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdcd d!„Zdcd"d#„Zd$d%„ Zd&d'„ Zdcd(d)„Zdcd*d+„Zd,d-„ Zd.d/„ Zd0d1„ Zd2d3„ Zd4d5„ Z d6d7„ Z!d8d9„ Z"d:d;„ Z#d<d=„ Z$d>d?„ Z%d@dA„ Z&dBdC„ Z'dDdE„ Z(dFdG„ Z)dHdI„ Z*dJdK„ Z+dddMdN„Z,dOdP„ Z-dQdR„ Z.dSdT„ Z/dUdV„ Z0dWdX„ Z1dYdZ„ Z2d[d\„ Z3d]d^„ Z4d_d`„ Z5dadb„ Z6dS )eÚColumnOperatorsa  Defines boolean, comparison, and other operators for
    :class:`.ColumnElement` expressions.

    By default, all methods call down to
    :meth:`.operate` or :meth:`.reverse_operate`,
    passing in the appropriate operator function from the
    Python builtin ``operator`` module or
    a SQLAlchemy-specific operator function from
    :mod:`sqlalchemy.expression.operators`.   For example
    the ``__eq__`` function::

        def __eq__(self, other):
            return self.operate(operators.eq, other)

    Where ``operators.eq`` is essentially::

        def eq(a, b):
            return a == b

    The core column expression unit :class:`.ColumnElement`
    overrides :meth:`.Operators.operate` and others
    to return further :class:`.ColumnElement` constructs,
    so that the ``==`` operation above is replaced by a clause
    construct.

    .. seealso::

        :ref:`types_operators`

        :attr:`.TypeEngine.comparator_factory`

        :class:`.ColumnOperators`

        :class:`.PropComparator`

    r   Nc                 C   r   )zdImplement the ``<`` operator.

        In a column context, produces the clause ``a < b``.

        )r   r   r   r   r   r   Ú__lt__T  r:   zColumnOperators.__lt__c                 C   r   )zfImplement the ``<=`` operator.

        In a column context, produces the clause ``a <= b``.

        )r   r
   r   r   r   r   Ú__le__\  r:   zColumnOperators.__le__c                 C   r   )z Implement the ``==`` operator.

        In a column context, produces the clause ``a = b``.
        If the target is ``None``, produces ``a IS NULL``.

        )r   r   r   r   r   r   rE   f  ó   zColumnOperators.__eq__c                 C   r   )z¥Implement the ``!=`` operator.

        In a column context, produces the clause ``a != b``.
        If the target is ``None``, produces ``a IS NOT NULL``.

        )r   r   r   r   r   r   Ú__ne__o  rP   zColumnOperators.__ne__c                 C   r   )zÈImplement the ``IS DISTINCT FROM`` operator.

        Renders "a IS DISTINCT FROM b" on most platforms;
        on some such as SQLite may render "a IS NOT b".

        .. versionadded:: 1.1

        )r   Úis_distinct_fromr   r   r   r   rR   x  ó   	z ColumnOperators.is_distinct_fromc                 C   r   )zÌImplement the ``IS NOT DISTINCT FROM`` operator.

        Renders "a IS NOT DISTINCT FROM b" on most platforms;
        on some such as SQLite may render "a IS b".

        .. versionadded:: 1.1

        )r   Úisnot_distinct_fromr   r   r   r   rT   ƒ  rS   z#ColumnOperators.isnot_distinct_fromc                 C   r   )zdImplement the ``>`` operator.

        In a column context, produces the clause ``a > b``.

        )r   r   r   r   r   r   Ú__gt__Ž  r:   zColumnOperators.__gt__c                 C   r   )zfImplement the ``>=`` operator.

        In a column context, produces the clause ``a >= b``.

        )r   r   r   r   r   r   Ú__ge__–  r:   zColumnOperators.__ge__c                 C   r#   )zaImplement the ``-`` operator.

        In a column context, produces the clause ``-a``.

        )r   r   r$   r   r   r   Ú__neg__ž  s   
zColumnOperators.__neg__c                 C   r   r&   )r   r   r   r   r   r   Ú__contains__¦  s   zColumnOperators.__contains__c                 C   r   )z‹Implement the [] operator.

        This can be used by some database-specific types
        such as PostgreSQL ARRAY and HSTORE.

        )r   r   )r   Úindexr   r   r   Ú__getitem__©  rP   zColumnOperators.__getitem__c                 C   r   )z²implement the << operator.

        Not used by SQLAlchemy core, this is provided
        for custom operator systems which want to use
        << as an extension point.
        )r   r   r   r   r   r   Ú
__lshift__²  rP   zColumnOperators.__lshift__c                 C   r   )z²implement the >> operator.

        Not used by SQLAlchemy core, this is provided
        for custom operator systems which want to use
        >> as an extension point.
        )r   r   r   r   r   r   Ú
__rshift__»  rP   zColumnOperators.__rshift__c                 C   r   )zœImplement the 'concat' operator.

        In a column context, produces the clause ``a || b``,
        or uses the ``concat()`` operator on MySQL.

        )r   Ú	concat_opr   r   r   r   ÚconcatÄ  rP   zColumnOperators.concatc                 C   ó   | j t||d�S )aü  Implement the ``like`` operator.

        In a column context, produces the expression::

            a LIKE other

        E.g.::

            stmt = select([sometable]).\
                where(sometable.c.column.like("%foobar%"))

        :param other: expression to be compared
        :param escape: optional escape character, renders the ``ESCAPE``
          keyword, e.g.::

            somecolumn.like("foo/%bar", escape="/")

        .. seealso::

            :meth:`.ColumnOperators.ilike`

        ©Úescape)r   Úlike_op©r   r   ra   r   r   r   ÚlikeÍ  s   zColumnOperators.likec                 C   r_   )a�  Implement the ``ilike`` operator, e.g. case insensitive LIKE.

        In a column context, produces an expression either of the form::

            lower(a) LIKE lower(other)

        Or on backends that support the ILIKE operator::

            a ILIKE other

        E.g.::

            stmt = select([sometable]).\
                where(sometable.c.column.ilike("%foobar%"))

        :param other: expression to be compared
        :param escape: optional escape character, renders the ``ESCAPE``
          keyword, e.g.::

            somecolumn.ilike("foo/%bar", escape="/")

        .. seealso::

            :meth:`.ColumnOperators.like`

        r`   )r   Úilike_oprc   r   r   r   Úilikeæ  s   zColumnOperators.ilikec                 C   r   )a/
  Implement the ``in`` operator.

        In a column context, produces the clause ``column IN <other>``.

        The given parameter ``other`` may be:

        * A list of literal values, e.g.::

            stmt.where(column.in_([1, 2, 3]))

          In this calling form, the list of items is converted to a set of
          bound parameters the same length as the list given::

            WHERE COL IN (?, ?, ?)

        * An empty list, e.g.::

            stmt.where(column.in_([]))

          In this calling form, the expression renders a "false" expression,
          e.g.::

            WHERE 1 != 1

          This "false" expression has historically had different behaviors
          in older SQLAlchemy versions, see
          :paramref:`.create_engine.empty_in_strategy` for behavioral options.

          .. versionchanged:: 1.2 simplified the behavior of "empty in"
             expressions

        * A bound parameter, e.g. :func:`.bindparam`, may be used if it
          includes the :paramref:`.bindparam.expanding` flag::

            stmt.where(column.in_(bindparam('value', expanding=True)))

          In this calling form, the expression renders a special non-SQL
          placeholder expression that looks like::

            WHERE COL IN ([EXPANDING_value])

          This placeholder expression is intercepted at statement execution
          time to be converted into the variable number of bound parameter
          form illustrated earlier.   If the statement were executed as::

            connection.execute(stmt, {"value": [1, 2, 3]})

          The database would be passed a bound parameter for each value::

            WHERE COL IN (?, ?, ?)

          .. versionadded:: 1.2 added "expanding" bound parameters

          The "expanding" feature in version 1.2 of SQLAlchemy does not
          support passing an empty list as a parameter value; however,
          version 1.3 does support this.

        * a :func:`.select` construct, which is usually a correlated
          scalar select::

            stmt.where(
                column.in_(
                    select([othertable.c.y]).
                    where(table.c.x == othertable.c.x)
                )
            )

          In this calling form, :meth:`.ColumnOperators.in_` renders as given::

            WHERE COL IN (SELECT othertable.y
            FROM othertable WHERE othertable.x = table.x)

        :param other: a list of literals, a :func:`.select` construct,
         or a :func:`.bindparam` construct that includes the
         :paramref:`.bindparam.expanding` flag set to True.

        )r   Úin_opr   r   r   r   Úin_  s   NzColumnOperators.in_c                 C   r   )aÞ  implement the ``NOT IN`` operator.

        This is equivalent to using negation with
        :meth:`.ColumnOperators.in_`, i.e. ``~x.in_(y)``.

        In the case that ``other`` is an empty sequence, the compiler
        produces an "empty not in" expression.   This defaults to the
        expression "1 = 1" to produce true in all cases.  The
        :paramref:`.create_engine.empty_in_strategy` may be used to
        alter this behavior.

        .. versionchanged:: 1.2  The :meth:`.ColumnOperators.in_` and
           :meth:`.ColumnOperators.notin_` operators
           now produce a "static" expression for an empty IN sequence
           by default.

        .. seealso::

            :meth:`.ColumnOperators.in_`

        )r   Únotin_opr   r   r   r   Únotin_S  r!   zColumnOperators.notin_c                 C   r_   )zÞimplement the ``NOT LIKE`` operator.

        This is equivalent to using negation with
        :meth:`.ColumnOperators.like`, i.e. ``~x.like(y)``.

        .. seealso::

            :meth:`.ColumnOperators.like`

        r`   )r   Ú
notlike_oprc   r   r   r   Únotlikek  ó   zColumnOperators.notlikec                 C   r_   )zâimplement the ``NOT ILIKE`` operator.

        This is equivalent to using negation with
        :meth:`.ColumnOperators.ilike`, i.e. ``~x.ilike(y)``.

        .. seealso::

            :meth:`.ColumnOperators.ilike`

        r`   )r   Únotilike_oprc   r   r   r   Únotilikex  rm   zColumnOperators.notilikec                 C   r   )aV  Implement the ``IS`` operator.

        Normally, ``IS`` is generated automatically when comparing to a
        value of ``None``, which resolves to ``NULL``.  However, explicit
        usage of ``IS`` may be desirable if comparing to boolean values
        on certain platforms.

        .. seealso:: :meth:`.ColumnOperators.isnot`

        )r   Úis_r   r   r   r   rp   …  ó   zColumnOperators.is_c                 C   r   )a`  Implement the ``IS NOT`` operator.

        Normally, ``IS NOT`` is generated automatically when comparing to a
        value of ``None``, which resolves to ``NULL``.  However, explicit
        usage of ``IS NOT`` may be desirable if comparing to boolean values
        on certain platforms.

        .. seealso:: :meth:`.ColumnOperators.is_`

        )r   Úisnotr   r   r   r   rr   ’  rq   zColumnOperators.isnotc                 K   ó   | j t|fi |¤ŽS )aû  Implement the ``startswith`` operator.

        Produces a LIKE expression that tests against a match for the start
        of a string value::

            column LIKE <other> || '%'

        E.g.::

            stmt = select([sometable]).\
                where(sometable.c.column.startswith("foobar"))

        Since the operator uses ``LIKE``, wildcard characters
        ``"%"`` and ``"_"`` that are present inside the <other> expression
        will behave like wildcards as well.   For literal string
        values, the :paramref:`.ColumnOperators.startswith.autoescape` flag
        may be set to ``True`` to apply escaping to occurrences of these
        characters within the string value so that they match as themselves
        and not as wildcard characters.  Alternatively, the
        :paramref:`.ColumnOperators.startswith.escape` parameter will establish
        a given character as an escape character which can be of use when
        the target expression is not a literal string.

        :param other: expression to be compared.   This is usually a plain
          string value, but can also be an arbitrary SQL expression.  LIKE
          wildcard characters ``%`` and ``_`` are not escaped by default unless
          the :paramref:`.ColumnOperators.startswith.autoescape` flag is
          set to True.

        :param autoescape: boolean; when True, establishes an escape character
          within the LIKE expression, then applies it to all occurrences of
          ``"%"``, ``"_"`` and the escape character itself within the
          comparison value, which is assumed to be a literal string and not a
          SQL expression.

          An expression such as::

            somecolumn.startswith("foo%bar", autoescape=True)

          Will render as::

            somecolumn LIKE :param || '%' ESCAPE '/'

          With the value of :param as ``"foo/%bar"``.

          .. versionadded:: 1.2

          .. versionchanged:: 1.2.0 The
            :paramref:`.ColumnOperators.startswith.autoescape` parameter is
             now a simple boolean rather than a character; the escape
             character itself is also escaped, and defaults to a forwards
             slash, which itself can be customized using the
             :paramref:`.ColumnOperators.startswith.escape` parameter.

        :param escape: a character which when given will render with the
          ``ESCAPE`` keyword to establish that character as the escape
          character.  This character can then be placed preceding occurrences
          of ``%`` and ``_`` to allow them to act as themselves and not
          wildcard characters.

          An expression such as::

            somecolumn.startswith("foo/%bar", escape="^")

          Will render as::

            somecolumn LIKE :param || '%' ESCAPE '^'

          The parameter may also be combined with
          :paramref:`.ColumnOperators.startswith.autoescape`::

            somecolumn.startswith("foo%bar^bat", escape="^", autoescape=True)

          Where above, the given literal parameter will be converted to
          ``"foo^%bar^^bat"`` before being passed to the database.

        .. seealso::

            :meth:`.ColumnOperators.endswith`

            :meth:`.ColumnOperators.contains`

            :meth:`.ColumnOperators.like`

        )r   Ústartswith_op©r   r   r8   r   r   r   Ú
startswithŸ  ó   VzColumnOperators.startswithc                 K   rs   )aã  Implement the 'endswith' operator.

        Produces a LIKE expression that tests against a match for the end
        of a string value::

            column LIKE '%' || <other>

        E.g.::

            stmt = select([sometable]).\
                where(sometable.c.column.endswith("foobar"))

        Since the operator uses ``LIKE``, wildcard characters
        ``"%"`` and ``"_"`` that are present inside the <other> expression
        will behave like wildcards as well.   For literal string
        values, the :paramref:`.ColumnOperators.endswith.autoescape` flag
        may be set to ``True`` to apply escaping to occurrences of these
        characters within the string value so that they match as themselves
        and not as wildcard characters.  Alternatively, the
        :paramref:`.ColumnOperators.endswith.escape` parameter will establish
        a given character as an escape character which can be of use when
        the target expression is not a literal string.

        :param other: expression to be compared.   This is usually a plain
          string value, but can also be an arbitrary SQL expression.  LIKE
          wildcard characters ``%`` and ``_`` are not escaped by default unless
          the :paramref:`.ColumnOperators.endswith.autoescape` flag is
          set to True.

        :param autoescape: boolean; when True, establishes an escape character
          within the LIKE expression, then applies it to all occurrences of
          ``"%"``, ``"_"`` and the escape character itself within the
          comparison value, which is assumed to be a literal string and not a
          SQL expression.

          An expression such as::

            somecolumn.endswith("foo%bar", autoescape=True)

          Will render as::

            somecolumn LIKE '%' || :param ESCAPE '/'

          With the value of :param as ``"foo/%bar"``.

          .. versionadded:: 1.2

          .. versionchanged:: 1.2.0 The
            :paramref:`.ColumnOperators.endswith.autoescape` parameter is
             now a simple boolean rather than a character; the escape
             character itself is also escaped, and defaults to a forwards
             slash, which itself can be customized using the
             :paramref:`.ColumnOperators.endswith.escape` parameter.

        :param escape: a character which when given will render with the
          ``ESCAPE`` keyword to establish that character as the escape
          character.  This character can then be placed preceding occurrences
          of ``%`` and ``_`` to allow them to act as themselves and not
          wildcard characters.

          An expression such as::

            somecolumn.endswith("foo/%bar", escape="^")

          Will render as::

            somecolumn LIKE '%' || :param ESCAPE '^'

          The parameter may also be combined with
          :paramref:`.ColumnOperators.endswith.autoescape`::

            somecolumn.endswith("foo%bar^bat", escape="^", autoescape=True)

          Where above, the given literal parameter will be converted to
          ``"foo^%bar^^bat"`` before being passed to the database.

        .. seealso::

            :meth:`.ColumnOperators.startswith`

            :meth:`.ColumnOperators.contains`

            :meth:`.ColumnOperators.like`

        )r   Úendswith_opru   r   r   r   Úendswith÷  rw   zColumnOperators.endswithc                 K   rs   )aü  Implement the 'contains' operator.

        Produces a LIKE expression that tests against a match for the middle
        of a string value::

            column LIKE '%' || <other> || '%'

        E.g.::

            stmt = select([sometable]).\
                where(sometable.c.column.contains("foobar"))

        Since the operator uses ``LIKE``, wildcard characters
        ``"%"`` and ``"_"`` that are present inside the <other> expression
        will behave like wildcards as well.   For literal string
        values, the :paramref:`.ColumnOperators.contains.autoescape` flag
        may be set to ``True`` to apply escaping to occurrences of these
        characters within the string value so that they match as themselves
        and not as wildcard characters.  Alternatively, the
        :paramref:`.ColumnOperators.contains.escape` parameter will establish
        a given character as an escape character which can be of use when
        the target expression is not a literal string.

        :param other: expression to be compared.   This is usually a plain
          string value, but can also be an arbitrary SQL expression.  LIKE
          wildcard characters ``%`` and ``_`` are not escaped by default unless
          the :paramref:`.ColumnOperators.contains.autoescape` flag is
          set to True.

        :param autoescape: boolean; when True, establishes an escape character
          within the LIKE expression, then applies it to all occurrences of
          ``"%"``, ``"_"`` and the escape character itself within the
          comparison value, which is assumed to be a literal string and not a
          SQL expression.

          An expression such as::

            somecolumn.contains("foo%bar", autoescape=True)

          Will render as::

            somecolumn LIKE '%' || :param || '%' ESCAPE '/'

          With the value of :param as ``"foo/%bar"``.

          .. versionadded:: 1.2

          .. versionchanged:: 1.2.0 The
            :paramref:`.ColumnOperators.contains.autoescape` parameter is
             now a simple boolean rather than a character; the escape
             character itself is also escaped, and defaults to a forwards
             slash, which itself can be customized using the
             :paramref:`.ColumnOperators.contains.escape` parameter.

        :param escape: a character which when given will render with the
          ``ESCAPE`` keyword to establish that character as the escape
          character.  This character can then be placed preceding occurrences
          of ``%`` and ``_`` to allow them to act as themselves and not
          wildcard characters.

          An expression such as::

            somecolumn.contains("foo/%bar", escape="^")

          Will render as::

            somecolumn LIKE '%' || :param || '%' ESCAPE '^'

          The parameter may also be combined with
          :paramref:`.ColumnOperators.contains.autoescape`::

            somecolumn.contains("foo%bar^bat", escape="^", autoescape=True)

          Where above, the given literal parameter will be converted to
          ``"foo^%bar^^bat"`` before being passed to the database.

        .. seealso::

            :meth:`.ColumnOperators.startswith`

            :meth:`.ColumnOperators.endswith`

            :meth:`.ColumnOperators.like`


        )r   Úcontains_opru   r   r   r   r   O  s   WzColumnOperators.containsc                 K   rs   )aY  Implements a database-specific 'match' operator.

        :meth:`~.ColumnOperators.match` attempts to resolve to
        a MATCH-like function or operator provided by the backend.
        Examples include:

        * PostgreSQL - renders ``x @@ to_tsquery(y)``
        * MySQL - renders ``MATCH (x) AGAINST (y IN BOOLEAN MODE)``
        * Oracle - renders ``CONTAINS(x, y)``
        * other backends may provide special implementations.
        * Backends without any special implementation will emit
          the operator as "MATCH".  This is compatible with SQLite, for
          example.

        )r   Úmatch_opru   r   r   r   Úmatch¨  s   zColumnOperators.matchc                 C   r#   )zMProduce a :func:`~.expression.desc` clause against the
        parent object.)r   Údesc_opr$   r   r   r   Údescº  ó   
zColumnOperators.descc                 C   r#   )zLProduce a :func:`~.expression.asc` clause against the
        parent object.)r   Úasc_opr$   r   r   r   Úasc¿  r   zColumnOperators.ascc                 C   r#   )zSProduce a :func:`~.expression.nullsfirst` clause against the
        parent object.)r   Únullsfirst_opr$   r   r   r   Ú
nullsfirstÄ  r   zColumnOperators.nullsfirstc                 C   r#   )zRProduce a :func:`~.expression.nullslast` clause against the
        parent object.)r   Únullslast_opr$   r   r   r   Ú	nullslastÉ  r   zColumnOperators.nullslastc                 C   r   )z¶Produce a :func:`~.expression.collate` clause against
        the parent object, given the collation string.

        .. seealso::

            :func:`~.expression.collate`

        )r   Úcollate)r   Ú	collationr   r   r   r†   Î  rS   zColumnOperators.collatec                 C   r   )zaImplement the ``+`` operator in reverse.

        See :meth:`.ColumnOperators.__add__`.

        )r9   r   r   r   r   r   Ú__radd__Ù  r:   zColumnOperators.__radd__c                 C   r   )zaImplement the ``-`` operator in reverse.

        See :meth:`.ColumnOperators.__sub__`.

        )r9   r   r   r   r   r   Ú__rsub__á  r:   zColumnOperators.__rsub__c                 C   r   )zaImplement the ``*`` operator in reverse.

        See :meth:`.ColumnOperators.__mul__`.

        )r9   r   r   r   r   r   Ú__rmul__é  r:   zColumnOperators.__rmul__c                 C   r   )zaImplement the ``/`` operator in reverse.

        See :meth:`.ColumnOperators.__div__`.

        )r9   r   r   r   r   r   Ú__rdiv__ñ  r:   zColumnOperators.__rdiv__c                 C   r   )zaImplement the ``%`` operator in reverse.

        See :meth:`.ColumnOperators.__mod__`.

        )r9   r   r   r   r   r   Ú__rmod__ù  r:   zColumnOperators.__rmod__Fc                 C   s   | j t|||d�S )z{Produce a :func:`~.expression.between` clause against
        the parent object, given the lower and upper range.

        ©Ú	symmetric)r   Ú
between_op)r   ÚcleftÚcrightrŽ   r   r   r   Úbetween  s   zColumnOperators.betweenc                 C   r#   )z[Produce a :func:`~.expression.distinct` clause against the
        parent object.

        )r   Údistinct_opr$   r   r   r   Údistinct  s   
zColumnOperators.distinctc                 C   r#   )a‹  Produce a :func:`~.expression.any_` clause against the
        parent object.

        This operator is only appropriate against a scalar subquery
        object, or for some backends an column expression that is
        against the ARRAY type, e.g.::

            # postgresql '5 = ANY (somearray)'
            expr = 5 == mytable.c.somearray.any_()

            # mysql '5 = ANY (SELECT value FROM table)'
            expr = 5 == select([table.c.value]).as_scalar().any_()

        .. seealso::

            :func:`~.expression.any_` - standalone version

            :func:`~.expression.all_` - ALL operator

        .. versionadded:: 1.1

        )r   Úany_opr$   r   r   r   Úany_  ó   
zColumnOperators.any_c                 C   r#   )a‹  Produce a :func:`~.expression.all_` clause against the
        parent object.

        This operator is only appropriate against a scalar subquery
        object, or for some backends an column expression that is
        against the ARRAY type, e.g.::

            # postgresql '5 = ALL (somearray)'
            expr = 5 == mytable.c.somearray.all_()

            # mysql '5 = ALL (SELECT value FROM table)'
            expr = 5 == select([table.c.value]).as_scalar().all_()

        .. seealso::

            :func:`~.expression.all_` - standalone version

            :func:`~.expression.any_` - ANY operator

        .. versionadded:: 1.1

        )r   Úall_opr$   r   r   r   Úall_(  r—   zColumnOperators.all_c                 C   r   )a4  Implement the ``+`` operator.

        In a column context, produces the clause ``a + b``
        if the parent object has non-string affinity.
        If the parent object has a string affinity,
        produces the concatenation operator, ``a || b`` -
        see :meth:`.ColumnOperators.concat`.

        )r   r   r   r   r   r   Ú__add__A  s   
zColumnOperators.__add__c                 C   r   )zdImplement the ``-`` operator.

        In a column context, produces the clause ``a - b``.

        )r   r   r   r   r   r   Ú__sub__M  r:   zColumnOperators.__sub__c                 C   r   )zdImplement the ``*`` operator.

        In a column context, produces the clause ``a * b``.

        )r   r   r   r   r   r   Ú__mul__U  r:   zColumnOperators.__mul__c                 C   r   )zdImplement the ``/`` operator.

        In a column context, produces the clause ``a / b``.

        )r   r   r   r   r   r   Ú__div__]  r:   zColumnOperators.__div__c                 C   r   )zdImplement the ``%`` operator.

        In a column context, produces the clause ``a % b``.

        )r   r   r   r   r   r   Ú__mod__e  r:   zColumnOperators.__mod__c                 C   r   )zeImplement the ``//`` operator.

        In a column context, produces the clause ``a / b``.

        )r   r   r   r   r   r   Ú__truediv__m  r:   zColumnOperators.__truediv__c                 C   r   )zfImplement the ``//`` operator in reverse.

        See :meth:`.ColumnOperators.__truediv__`.

        )r9   r   r   r   r   r   Ú__rtruediv__u  r:   zColumnOperators.__rtruediv__r&   ©F)7r;   r<   r=   r>   r?   Ú	timetuplerN   rO   r   rG   rE   rQ   rR   rT   rU   rV   rW   rX   rZ   r[   r\   r^   rd   rf   rh   rj   rl   ro   rp   rr   rv   ry   r   r|   r~   r�   rƒ   r…   r†   rˆ   r‰   rŠ   r‹   rŒ   r’   r”   r–   r™   rš   r›   rœ   r�   rž   rŸ   r    r   r   r   r   rM   )  sj    %					
	
P

XXY
rM   c                   C   ó   t ƒ ‚r&   ©r5   r   r   r   r   Úfrom_~  ó   r¥   c                   C   r£   r&   r¤   r   r   r   r   Úas_‚  r¦   r§   c                   C   r£   r&   r¤   r   r   r   r   Úexists†  r¦   r¨   c                 C   r£   r&   r¤   ©Úar   r   r   ÚistrueŠ  r¦   r«   c                 C   r£   r&   r¤   r©   r   r   r   ÚisfalseŽ  r¦   r¬   c                 C   ó
   |   |¡S r&   )rR   ©rª   Úbr   r   r   rR   ’  r*   rR   c                 C   r­   r&   )rT   r®   r   r   r   rT   –  r*   rT   c                 C   r­   r&   )rp   r®   r   r   r   rp   š  r*   rp   c                 C   r­   r&   )rr   r®   r   r   r   rr   ž  r*   rr   c                 C   r­   r&   )r†   r®   r   r   r   r†   ¢  r*   r†   c                 C   s   |   |¡|ƒS r&   r1   )rª   r,   r¯   r   r   r   r0   ¦  ó   r0   Nc                 C   ó   | j ||d�S ©Nr`   )rd   ©rª   r¯   ra   r   r   r   rb   ª  r°   rb   c                 C   r±   r²   )rl   r³   r   r   r   rk   ®  r°   rk   c                 C   r±   r²   )rf   r³   r   r   r   re   ²  r°   re   c                 C   r±   r²   )ro   r³   r   r   r   rn   ¶  r°   rn   Fc                 C   ó   | j |||d�S ©Nr�   )r’   ©rª   r¯   ÚcrŽ   r   r   r   r�   º  ó   r�   c                 C   r´   rµ   )Ú
notbetweenr¶   r   r   r   Únotbetween_op¾  r¸   rº   c                 C   r­   r&   )rh   r®   r   r   r   rg   Â  r*   rg   c                 C   r­   r&   )rj   r®   r   r   r   ri   Æ  r*   ri   c                 C   ó   |   ¡ S r&   )r”   r©   r   r   r   r“   Ê  rH   r“   c                 C   r»   r&   )r–   r©   r   r   r   r•   Î  rH   r•   c                 C   r»   r&   )r™   r©   r   r   r   r˜   Ò  rH   r˜   c                 C   sx   |r6|durt  d¡ |d u rd}t|t jjƒstdƒ‚|dvr(| ||| ¡}| d|d ¡ d|d ¡}| ||d�S )	NTz;The autoescape parameter is now a simple boolean True/Falseú/z*String value expected when autoescape=True)ú%Ú_r½   r¾   r`   )r   ÚwarnrD   ÚcompatÚstring_typesÚ	TypeErrorÚreplace)Úfnr   ra   Ú
autoescaper   r   r   Ú_escaped_like_implÖ  s   ÿrÆ   c                 C   ó   t | j|||ƒS r&   ©rÆ   rv   ©rª   r¯   ra   rÅ   r   r   r   rt   ê  r¸   rt   c                 C   ó   t | j|||ƒ S r&   rÈ   rÉ   r   r   r   Únotstartswith_opî  ó   rË   c                 C   rÇ   r&   ©rÆ   ry   rÉ   r   r   r   rx   ò  r¸   rx   c                 C   rÊ   r&   rÍ   rÉ   r   r   r   Únotendswith_opö  rÌ   rÎ   c                 C   rÇ   r&   ©rÆ   r   rÉ   r   r   r   rz   ú  r¸   rz   c                 C   rÊ   r&   rÏ   rÉ   r   r   r   Únotcontains_opþ  rÌ   rÐ   c                 K   ó   | j |fi |¤ŽS r&   )r|   ©rª   r¯   rK   r   r   r   r{     rÌ   r{   c                 K   rÑ   r&   )ÚnotmatchrÒ   r   r   r   Únotmatch_op  rÌ   rÔ   c                 C   r£   r&   r¤   r®   r   r   r   Úcomma_op
  r¦   rÕ   c                 C   r£   r&   r¤   r®   r   r   r   Úempty_in_op  r¦   rÖ   c                 C   r£   r&   r¤   r®   r   r   r   Úempty_notin_op  r¦   r×   c                 C   r­   r&   )r^   r®   r   r   r   r]     r*   r]   c                 C   r»   r&   )r~   r©   r   r   r   r}     rH   r}   c                 C   r»   r&   )r�   r©   r   r   r   r€     rH   r€   c                 C   r»   r&   )rƒ   r©   r   r   r   r‚   "  rH   r‚   c                 C   r»   r&   )r…   r©   r   r   r   r„   &  rH   r„   c                 C   r£   r&   r¤   r®   r   r   r   Újson_getitem_op*  r¦   rØ   c                 C   r£   r&   r¤   r®   r   r   r   Újson_path_getitem_op.  r¦   rÙ   c                 C   ó   | t v pt| tƒo| jS r&   )Ú_comparisonrD   r+   r.   r1   r   r   r   r.   D  s   r.   c                 C   s   | t v S r&   )Ú_commutativer1   r   r   r   Úis_commutativeH  rH   rÝ   c                 C   s   | t tttfv S r&   )r€   r}   r‚   r„   r1   r   r   r   Úis_ordering_modifierL  r¸   rÞ   c                 C   rÚ   r&   )Ú_natural_self_precedentrD   r+   r@   r1   r   r   r   Úis_natural_self_precedentP  s   
ýrà   c                 C   s   t | ƒp| tv S r&   )r.   Ú	_booleansr1   r   r   r   Ú
is_boolean[  r¸   râ   c                 C   s   t  | | ¡S )z[rotate a comparison operator 180 degrees.

    Note this is not the same as negation.

    )Ú_mirrorÚgetr1   r   r   r   Úmirrorb  r:   rå   Ú_asbooliöÿÿÿ)Ú	canonicalÚ	_smallestiœÿÿÿÚ_largestéd   é   é   é   é   é   é   éÿÿÿÿé   c                 C   s<   | |u r
t | ƒr
dS t | t| dtƒ¡t |t|dtƒ¡kS )NFr-   )rà   Ú_PRECEDENCErä   Úgetattrrè   ré   )r(   r)   r   r   r   Úis_precedent±  s   ÿþrõ   r&   r¡   )NF)Zr>   r(   r   r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   Ú r   Úpy2kr   Úobjectr   r+   rM   r¥   r§   r¨   r«   r¬   rR   rT   rp   rr   r†   r0   rb   rk   re   rn   r�   rº   rg   ri   r“   r•   r˜   rÆ   rt   rË   rx   rÎ   rz   rÐ   r{   rÔ   rÕ   rÖ   r×   r]   r}   r€   r‚   r„   rØ   rÙ   rÜ   rÛ   r.   rÝ   rÞ   rà   rá   râ   rã   rå   ÚunionÚ
differenceÚ_associativerß   Úsymbolræ   rè   ré   ró   rõ   r   r   r   r   Ú<module>   s¢  
 H8      [











ô	ÿÿþýüûúùø	÷
öõôóòñðïîíìëêéèçæåäãâá à!ß"Þ#Ý$Ü%Û&Ú'Ù(Ø)×*Ö+Õ,Ô-Ó.Ò/Ñ0Ð1Ï2Î3Í7