관리-도구
편집 파일: enumerated.cpython-37.pyc
B ��4]+, � @ s� d dl Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ G d d � d e�ZG dd� dej ej e�ZG d d� de�ZdS )� N� )�_StringType� )�exc)�sql)�util)�sqltypesc @ s e Zd Zdd� Zedd� �ZdS )�_EnumeratedValuesc C s� |� dd�| _| jdkr�t|�r�d }xd|D ]V}t|�dkrDd| _P n|d krT|d }t|�dksx|d |ksx|d |kr*d| _P q*W d| _| jdkr�t�d| jj � | �|�}|| _t d d � |D �dg �}||fS )N�quoting�autor Zunquotedr ���Zquotedz|Manually quoting %s value literals is deprecated. Supply unquoted values and use the quoting= option in cases of ambiguity.c S s g | ]}t |��qS � )�len)�.0�vr r �W/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/dialects/mysql/enumerated.py� <listcomp>/ s z2_EnumeratedValues._init_values.<locals>.<listcomp>) �popr r r Zwarn_deprecated� __class__�__name__� _strip_valuesZ_enumerated_values�max)�self�values�kw�q�e�lengthr r r �_init_values s* $ z_EnumeratedValues._init_valuesc C s` g }xV|D ]N}|dd� dks.|dd� dkrN|dd� � |d d |d �}|�|� q W |S )Nr r �"�'r � )�replace�append)�clsr Zstrip_values�ar r r r 2 s z_EnumeratedValues._strip_valuesN)r � __module__�__qualname__r �classmethodr r r r r r s r c sP e Zd ZdZd ZdZdd� Zedd� �Z� fdd�Z � fd d �Z dd� Z� ZS ) �ENUMzMySQL ENUM type.Tc O s4 |� dd� | �||� tj| fd| ji|�� dS )a~ Construct an ENUM. E.g.:: Column('myenum', ENUM("foo", "bar", "baz")) :param enums: The range of valid values for this ENUM. Values will be quoted when generating the schema according to the quoting flag (see below). This object may also be a PEP-435-compliant enumerated type. .. versionadded: 1.1 added support for PEP-435-compliant enumerated types. :param strict: This flag has no effect. .. versionchanged:: The MySQL ENUM type as well as the base Enum type now validates all Python data values. :param charset: Optional, a column-level character set for this string value. Takes precedence to 'ascii' or 'unicode' short-hand. :param collation: Optional, a column-level collation for this string value. Takes precedence to 'binary' short-hand. :param ascii: Defaults to False: short-hand for the ``latin1`` character set, generates ASCII in schema. :param unicode: Defaults to False: short-hand for the ``ucs2`` character set, generates UNICODE in schema. :param binary: Defaults to False: short-hand, pick the binary collation type that matches the column's character set. Generates BINARY in schema. This does not affect the type of data stored, only the collation of character data. :param quoting: Defaults to 'auto': automatically determine enum value quoting. If all enum values are surrounded by the same quoting character, then use 'quoted' mode. Otherwise, use 'unquoted' mode. 'quoted': values in enums are already quoted, they will be used directly when generating the schema - this usage is deprecated. 'unquoted': values in enums are not quoted, they will be escaped and surrounded by single quotes when generating the schema. Previous versions of this type always required manually quoted values to be supplied; future versions will always quote the string literals for you. This is a transitional option. �strictNr )r Z _enum_initr �__init__r )r Zenumsr r r r r+ D s 5z ENUM.__init__c K s&