U kfq@sddlmZddlZddlmZddlmZddlmZddlmZdd lmZ dd l m Z dd l mZd d gZiZdddd ZddZ dd ZddZGdddZGdddZGdddZddZddZdS) ) annotationsN)config) exclusions)event)schema)types) mapped_column) OrderedDictTableColumnz schema.Table)returncsfddtD}tttjdrjdkrdkrdkrd|ksVd|kr`d d<qd d<nHttjd rd krd krdkrd|ksd|krd d <nd d <tj|S)z8A schema.Table wrapper/hook for dialect-specific tweaks.cs"i|]}|dr||qSZtest_ startswithpop.0kkwI/opt/hc_python/lib64/python3.8/site-packages/sqlalchemy/testing/schema.py s zTable..mysqlZ mysql_engineZ mysql_typeZ autoload_withZ test_needs_fkZtest_needs_acidZInnoDBZMyISAMZmariadbZmariadb_engineZ mariadb_type) listupdate table_optionsragainstr_currentrr )argsr test_optsrrrr s.    cOs tt||S)z>An orm.mapped_column wrapper/hook for dialect-specific tweaks.)_schema_column_orm_mapped_columnr!rrrrr ?sr cOsttj||S)z9A schema.Column wrapper/hook for dialect-specific tweaks.)r#rr r%rrrr EscsfddtD}tjjts2dd|D}||}|tjkrL|}n|j}|ddrddr|j dkr|j dkrd|_ d|j d<t tjd rd d }tj|d |dd |S)Ncs"i|]}|dr||qSrrrrrrrLs z"_schema_column..cSsg|]}t|tjs|qSr) isinstancerZ ForeignKey)rargrrr Os z"_schema_column..Ztest_needs_autoincrementFZ primary_keyToraclecSs2|tjttjj|jd|jddddS)N_Z_seqT)optional)Z _init_itemsrSequence_truncate_namerdbdialectname)cZtblrrradd_seqesz_schema_column..add_seqZafter_parent_attach) propagate)rr requirementsZforeign_key_ddlZenabled_for_configrr columngetdefaultZserver_defaultZ autoincrementinforrr rlisten)factoryr!rr"Z constructcolr2rrrr#Ks$    r#c@s(eZdZdZddZddZddZdS) eq_type_affinityaHelper to compare types inside of datastructures based on affinity. E.g.:: eq_( inspect(connection).get_columns("foo"), [ { "name": "id", "type": testing.eq_type_affinity(sqltypes.INTEGER), "nullable": False, "default": None, "autoincrement": False, }, { "name": "data", "type": testing.eq_type_affinity(sqltypes.NullType), "nullable": True, "default": None, "autoincrement": False, }, ], ) cCst||_dSN)sqltypesZ to_instancetargetselfr?rrr__init__szeq_type_affinity.__init__cCs|jj|jkSr=r?Z_type_affinityrAotherrrr__eq__szeq_type_affinity.__eq__cCs|jj|jk Sr=rCrDrrr__ne__szeq_type_affinity.__ne__N__name__ __module__ __qualname____doc__rBrFrGrrrrr<ssr<c@s(eZdZdZddZddZddZdS) eq_compile_typez,similar to eq_type_affinity but uses compilecCs ||_dSr=r?r@rrrrBszeq_compile_type.__init__cCs|j|kSr=r?compilerDrrrrFszeq_compile_type.__eq__cCs|j|kSr=rOrDrrrrGszeq_compile_type.__ne__NrHrrrrrMsrMc@s(eZdZdZddZddZddZdS) eq_clause_elementz3Helper to compare SQL structures based on compare()cCs ||_dSr=rNr@rrrrBszeq_clause_element.__init__cCs |j|Sr=r?comparerDrrrrFszeq_clause_element.__eq__cCs|j| Sr=rRrDrrrrGszeq_clause_element.__ne__NrHrrrrrQsrQcCsJt||jkrB|dt|jdddtt|dddS|SdS)Nrr*@r)lenZmax_identifier_lengthmaxhexhash)r/r0rrrr-sr-c st}d fdd }itfdd}t|tf|||d}ztdjdd}Wntt fk rnYnX|dk r~||_ |S) NcsL||_||_||j|<||<t|j|||rH||j|<t|j||dSr=)r0value __members__setattr __class__)rAr0rZaliasZvalue_to_memberrrrBs  zpep435_enum..__init__cs|Sr=r)clsrZr_rrr6szpep435_enum..get)r[rBr6rrI__main__)N) r classmethodtypeobjectsys _getframe f_globalsr6AttributeError ValueErrorrJ)r0r[rBr6Zsomeenummodulerr_r pep435_enums"  rk) __future__rrerrrrr r>Zormr r$utilr __all__rr r r#r<rMrQr-rkrrrr s&        %(%