관리-도구
편집 파일: operators.cpython-37.pyc
B ��4]� � j @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd lm Z dd lm Z ddlmZ ddlmZ dd lm Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ej�r ddlmZ neZG dd� de�ZG dd� de�ZG dd� de�ZeeeehZeeeeee hZdd� Zd d!� Z d"d#� Z!e d$d%� �Z"d&d'� Z#d(d)� Z$d*d+� Z%d,d-� Z&e d.d/� �Z'e d0d1� �Z(e d2d3� �Z)e d4d5� �Z*d6d7� Z+d8d9� Z,e d�d;d<��Z-e d�d=d>��Z.e d�d?d@��Z/e d�dAdB��Z0e d�dDdE��Z1e d�dFdG��Z2e dHdI� �Z3e dJdK� �Z4dLdM� Z5dNdO� Z6dPdQ� Z7dRdS� Z8e d�dTdU��Z9e d�dVdW��Z:e d�dXdY��Z;e d�dZd[��Z<e d�d\d]��Z=e d�d^d_��Z>e d`da� �Z?e dbdc� �Z@ddde� ZAe dfdg� �ZBe dhdi� �ZCdjdk� ZDdldm� ZEdndo� ZFdpdq� ZGdrds� ZHdtdu� ZIdvdw� ZJdxdy� ZKdzd{� ZLd|d}� ZMd~d� ZNd�d�� ZOe e%e&eefZPd�d�� ZQeeee eee eiZRd�d�� ZSe�TeEeeg��Ueeg�ZVeV�TeeJeKg�ZWejXd�d�d��ZYejXd�d�d��ZZejXd�d�d��Z[e!d�e"d�e6d�e7d�ed�eJd�eKd�ed�ed�ed�e d�ed�ed�ed�eEd�eDd�e?d�e@d�e/d�e0d�e-d�e.d�e3d�e4d�e)d�e*d�ed�ed�e'd�e(d�eBd�eCd�ed�ed�ed�e d�e1d�e2d�e5d�e d�e%d�e&d�ed�edeAd�eFd�eGd�e+d�e#d�e$deYd�eZeZe[e[i5Z\d�d�� Z]d:S )�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 @ sP e Zd ZdZdZdd� Zdd� Zdd� Zddd �Zddd�Z dd� Z dd� ZdS )� 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 s | � 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 �K/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/sql/operators.py�__and__; s zOperators.__and__c C s | � t|�S )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 r �__or__S s zOperators.__or__c C s | � 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 zOperators.__invert__r FNc s t ||||�� � �fdd�}|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� s zOperators.op.<locals>.against)� custom_op)r �opstring� precedence� is_comparison�return_typer"