U of @spddlmZddlZddlmZddlmZddlmZddZ d d Z dd d Z dddddZ dddZ dS)) annotationsN)Union)inspect_getfullargspec)sqla_2cs`ddlm}t|D]}|qt|jfdd|DddtddS) a A facade around @testing.combinations() oriented towards boolean keyword-based arguments. Basically generates a nice looking identifier based on the keywords and also sets up the argument names. E.g.:: @testing.flag_combinations( dict(lazy=False, passive=False), dict(lazy=True, passive=False), dict(lazy=False, passive=True), dict(lazy=False, passive=True, raiseload=True), ) would result in:: @testing.combinations( ('', False, False, False), ('lazy', True, False, False), ('lazy_passive', True, True, False), ('lazy_passive', True, True, True), id_='iaaa', argnames='lazy,passive,raiseload' ) rconfigcs<g|]4dfddDftfddDqS)_c3s|]}|dr|VqdSFNget.0kdB/opt/hc_python/lib/python3.8/site-packages/alembic/testing/util.py 9s z/flag_combinations...c3s|]}|dVqdSr r r rrrr:s)jointuple)rkeysrr 8sz%flag_combinations..ia,)Zid_argnames)sqlalchemy.testingrsetupdatesorted combinationslenr)r"rrrrrflag_combinationss   r$c sJt|d}fdd|D}t|j}|t|j|}|f|S)zGiven a no-arg lambda and a namespace, return a new lambda that has all the values filled in. This is used so that we can have module-level fixtures that refer to instance-level variables using lambdas. rcsi|]}||qSr)pop)rargkwrr Lsz"resolve_lambda..)rdict __globals__r types FunctionType__code__)Z__fnr(Zpos_argsZ pass_pos_argsZglbZnew_fnrr'rresolve_lambdaBs   r/functioncs,ddlmddlmfdd}|S)z&Provide MetaData for a pytest fixture.rr)fixture_functionscsfdd}jd|S)Nc 3sNddlm}|}|_z ||}|j|VW5|jXdS)Nr)schema)Z sqlalchemyr3ZMetaDatametadataZdrop_alldbZ create_all)selfr3r4result)rfnrrrun_ddlZs    z3metadata_fixture..decorate..run_ddl)scope)Zfixture)r8r9rddlr2)r8rdecorateYs z"metadata_fixture..decorate)rrr2)r<r=rr;rmetadata_fixtureSs  r?strzUnion[int, str])valuereturncCs z t|WS|YSXdS)N)int)rArrr _safe_intls rDFcCsTddlm}ddlm}|s,t|jjdd}tsB|rs    1