U of;$@sUddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z dd lm Z dd lm Z dd lm Z dd lm Z dd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZe rddlmZddlmZddlmZeeefZe dedZiZ de!d<GdddeZ"Gdd d eeZ#Gd!d"d"e#eZ$Gd#d$d$e#eZ%Gd%d&d&e#eZ&d d'd(d)d*Z'd d+d(d,d-Z(d d.d(d/d0Z)d1S)2) annotations)Any)ClassVar)Dict)Generic) NamedTuple)Optional)Sequence)Tuple)Type) TYPE_CHECKING)TypeVar)Union) Constraint)ForeignKeyConstraint)Index)UniqueConstraint) TypeGuard)util) sqla_compat)Literal)AutogenContext) DefaultImpl_C)boundz Dict[str, Type[_constraint_sig]]_clsregc@seZdZUded<ded<eddddZeddd d Zeddd d Zeddd dZ edddddZ edddddZ dS)ComparisonResultz'Literal[('equal', 'different', 'skip')]statusstrmessageboolreturncCs |jdkS)Nequalrselfr(B/opt/hc_python/lib/python3.8/site-packages/alembic/ddl/_autogen.pyis_equal-szComparisonResult.is_equalcCs |jdkS)N differentr%r&r(r(r) is_different1szComparisonResult.is_differentcCs |jdkS)Nskipr%r&r(r(r)is_skip5szComparisonResult.is_skipcCs |ddS)zthe constraints are equal.r$zThe two constraints are equalr(clsr(r(r)Equal9szComparisonResult.EqualzUnion[str, Sequence[str]])reasonr#cCs|ddt|S)z9the constraints are different for the provided reason(s).r+, joinrZto_listr0r2r(r(r) Different>szComparisonResult.DifferentcCs|ddt|S)zthe constraint cannot be compared for the provided reason(s). The message is logged, but the constraints will be otherwise considered equal, meaning that no migration command will be generated. r-r3r4r6r(r(r)SkipCszComparisonResult.SkipN) __name__ __module__ __qualname____annotations__propertyr*r,r. classmethodr1r7r8r(r(r(r)r)s rc@sDeZdZUded<ded<ded<ded<d Zd ed <d Zd ed <d Zd ed <ded<ddddZeddZ dddddddZ dddddZ ddddd Z eddddd!d"d#Z d$d%d&d'd(Zejd)d*Zejddd+d,Zejddd-d.Zejddd/d0Zddd1d2Zddd3d4Zd5dd6d7Zd8S)9_constraint_sigrconstzTuple[Any, ...]_sigz,Optional[sqla_compat._ConstraintNameDefined]namerimplFzClassVar[bool] _is_index_is_fk_is_uqr! _is_metadataNoner"cCs |dSN) _registerr/r(r(r)__init_subclass__\sz!_constraint_sig.__init_subclass__cCs tdSrINotImplementedErrorr/r(r(r)rJ_sz_constraint_sig._register is_metadatarCr@r#cCs tdSrIrLr'rOrCr@r(r(r)__init__csz_constraint_sig.__init__z_constraint_sig[Any]rotherr#cCs.|j|jkst|jst|jr$t||SrI)rCAssertionErrorrG_compare_to_reflectedr'rSr(r(r)compare_to_reflectedhs  z$_constraint_sig.compare_to_reflected_constraint_sig[_C]cCs tdSrIrLrVr(r(r)rUqsz%_constraint_sig._compare_to_reflected)rOrC constraintr#cCst|j|||}|SrI)rZ__visit_name__)r0rOrCrYsigr(r(r)from_constraintvsz_constraint_sig.from_constraintrz Optional[str])contextr#cCst|j|jSrI)rZ_get_constraint_final_namer@dialect)r'r\r(r(r)md_name_to_sql_namesz#_constraint_sig.md_name_to_sql_namecCst|j|jjSrI)rZ_constraint_is_namedr@rCr]r&r(r(r)is_namedsz_constraint_sig.is_namedcCs|jSrI)rAr&r(r(r)unnamedsz_constraint_sig.unnamedcCs tdSrIrLr&r(r(r)unnamed_no_optionssz"_constraint_sig.unnamed_no_optionscCs|jf|jSrI)rBr`r&r(r(r) _full_sigsz_constraint_sig._full_sigcCs |j|jkSrIrbrVr(r(r)__eq__sz_constraint_sig.__eq__cCs |j|jkSrIrcrVr(r(r)__ne__sz_constraint_sig.__ne__intcCs t|jSrI)hashrbr&r(r(r)__hash__sz_constraint_sig.__hash__N)r9r:r;r<rDrErFrKr>rJrQrWrUr[r^rmemoized_propertyr_r`rarbrdrerhr(r(r(r)r?Ns8        r?c@s\eZdZdZeddddZdZddddd d d Zed dd dZ dddddZ dS)_uq_constraint_sigTrHr"cCs |td<dS)NZunique_constraintrr/r(r(r)rJsz_uq_constraint_sig._registerr!rrrNcCs>||_||_t|j|_ttdd|jD|_||_ dS)NcSsg|] }|jqSr(rB.0colr(r(r) sz/_uq_constraint_sig.__init__..) rCr@rconstraint_name_or_nonerBtuplesortedcolumnsrArGrPr(r(r)rQs z_uq_constraint_sig.__init__Tuple[str, ...]cCstdd|jjDS)NcSsg|] }|jqSr(rlrmr(r(r)rpsz3_uq_constraint_sig.column_names..rrr@rtr&r(r(r) column_namessz_uq_constraint_sig.column_namesrXrrRcCs0|js t|}|}t|st|j|j|jSrI)rGrT is_uq_sigrCZcompare_unique_constraintr@r'rSZ metadata_objZconn_objr(r(r)rUs  z(_uq_constraint_sig._compare_to_reflectedN) r9r:r;rFr>rJ is_uniquerQr=rwrUr(r(r(r)rjs rjc@seZdZUdZded<eddddZdd d dd d d ZdddddZe j ddZ e j ddddZ e j ddddZ e j ddZe j ddZdS) _ix_constraint_sigTzsqla_compat._ConstraintNamerBrHr"cCs |td<dS)Nindexrkr/r(r(r)rJsz_ix_constraint_sig._registerr!rrrNcCs*||_||_|j|_t|j|_||_dSrI)rCr@rBr!uniquerzrGrPr(r(r)rQs  z_ix_constraint_sig.__init__rXrrRcCs0|js t|}|}t|st|j|j|jSrI)rGrT is_index_sigrCZcompare_indexesr@ryr(r(r)rUs   z(_ix_constraint_sig._compare_to_reflectedcCs t|jSrI)rZis_expression_indexr@r&r(r(r)has_expressionssz"_ix_constraint_sig.has_expressionsrucCstdd|jjDS)NcSsg|] }|jqSr(rlrmr(r(r)rpsz3_ix_constraint_sig.column_names..rvr&r(r(r)rwsz_ix_constraint_sig.column_nameszTuple[Optional[str], ...]cCstdd|jjDS)NcSsg|]}t|ddqS)rBN)getattrrmr(r(r)rpsz<_ix_constraint_sig.column_names_optional..)rrr@Z expressionsr&r(r(r)column_names_optionalsz(_ix_constraint_sig.column_names_optionalcCsdS)NTr(r&r(r(r)r_sz_ix_constraint_sig.is_namedcCs|jf|jSrI)rzrr&r(r(r)r`sz_ix_constraint_sig.unnamedN)r9r:r;rDr<r>rJrQrUrrirrwrr_r`r(r(r(r)r{s     r{c@sDeZdZdZeddddZddddd d d Zejd d Z dS)_fk_constraint_sigTrHr"cCs |td<dS)NZforeign_key_constraintrkr/r(r(r)rJsz_fk_constraint_sig._registerr!rrrNc Cs||_||_||_t|j|_t|\ |_|_|_ |_ |_ |_ }}}}|j|jt |j |j |j t |j f|r|dkrdq|nd|r|dkrdq|nd|r|dkrdn |rdndf|_dS)Nz no actiondeferredZinitially_deferrable deferrableznot deferrable)rGrCr@rrqrBZ_fk_spec source_schema source_tablesource_columns target_schema target_tabletarget_columnsrrlowerrA)r'rOrCr@ZonupdateZondeleterZ initiallyr(r(r)rQsH    z_fk_constraint_sig.__init__cCs$|j|jt|j|j|jt|jfSrI)rrrrrrrrr&r(r(r)ra4sz%_fk_constraint_sig.unnamed_no_optionsN) r9r:r;rEr>rJrQrrirar(r(r(r)rs 4rzTypeGuard[_ix_constraint_sig])rZr#cCs|jSrI)rDrZr(r(r)r~@sr~zTypeGuard[_uq_constraint_sig]cCs|jSrI)rFrr(r(r)rxDsrxzTypeGuard[_fk_constraint_sig]cCs|jSrI)rErr(r(r) is_fk_sigHsrN)* __future__rtypingrrrrrrr r r r r rZsqlalchemy.sql.schemarrrrtyping_extensionsrrrrZalembic.autogenerate.apirZalembic.ddl.implrZCompareConstraintTyperrr<rr?rjr{rr~rxrr(r(r(r)sF                          %R&3G