bgddlmZddlmZddlZddlZddlZddlZddlZddl m Z ddl m Z ddl m Z ddl mZddl mZdd l mZdd l mZdd l mZdd l mZdd l mZddl mZddl mZddlmZddlmZddlmZddlmZddlmZerddlmZddlm Z ddl!m"Z"ddl!m#Z#ddl$m%Z% ddl&m'Z'n #e($rdZ'YnwxYwee)ee)fZ*ej+dZ,ej+dZ-ej+dZ.ej+d Z/ej+d!Z0d"Z1ej+d#Z2ej+d$Z3Gd%d&Z4Gd'd(ej%Z5dS))) annotations)contextmanagerN) ModuleType)Any)cast)Iterator)List)Mapping)Optional)Sequence)Set)Tuple) TYPE_CHECKING)Unionrevision) write_hooks)util) migration)not_none)Config)MessagingOptions) RevisionStep) StampStep)Revision)tzz (?!\.\#|__init__)(.*\.py)(c|o)?$z(?!\.\#|__init__)(.*\.py)$z([a-f0-9]+)\.py$z(upgrade|downgrade)_([a-z0-9]+)z\w+z%(rev)s_%(slug)sz , *|(?: +)z , *|(?: +)|\:c eZdZdZedddddddedejf dadZe dbdZ ej dZ dcdZ eddd Ze dedfd'Z dgdhd+Zdid/Zdjd2Zdkd4Zdld6Zdmd<Zdnd=Zdod?Zdnd@ZdodAZdpdEZdqdFZdrdIZdsdJZe dKZ dtdNZ!dudOZ"dvdQZ#dwdSZ$ dxdyd]Z%dzd`Z&dS){ScriptDirectoryaHProvides operations upon an Alembic script directory. This object is useful to get information as to current revisions, most notably being able to get at the "head" revision, for schemes that want to test if the current revision in the database is the most recent:: from alembic.script import ScriptDirectory from alembic.config import Config config = Config() config.set_main_option("script_location", "myapp:migrations") script = ScriptDirectory.from_config(config) head_revision = script.get_current_head() (NFutf-8rdirstr file_templatetruncate_slug_length Optional[int]version_locationsOptional[List[str]] sourcelessbooloutput_encodingtimezone Optional[str] hook_configOptional[Mapping[str, str]]recursive_version_locationsmessaging_optsreturnNonec x||_||_||_|pd|_||_||_t j|j|_ ||_ ||_ | |_ | |_ tj|tjs4t#jdtj|zdS)Nr!zVPath doesn't exist: %r. Please use the 'init' command to create a new scripts folder.)r#r%r(r&r*r,r RevisionMap_load_revisions revision_mapr-r/r1r2osaccessF_OKr CommandErrorpathabspath) selfr#r%r&r(r*r,r-r/r1r2s J/opt/cloudlinux/venv/lib64/python3.11/site-packages/alembic/script/base.py__init__zScriptDirectory.__init__Js*!2$8$>B!$.$01EFF  &+F(,ybg&& #"$&GOOC$8$89   cn|j}t|dkrtjd|dS)Nrz"Multiple version_locations presentr)_version_locationslenrr<)r?locs r@versionszScriptDirectory.versionsls4% s88a<<#$HII Iq6MrBc|jrd|jDStjtj|jdfS)Ncpg|]3}tjtj|4S)r9r=r>rcoerce_resource_to_filename).0locations r@ z6ScriptDirectory._version_locations..wsA @ J JKKrBrG)r(r9r=r>joinr#r?s r@rDz"ScriptDirectory._version_locationsts]  ! J $ 6  GOOBGLL:$F$FGGI IrBIterator[Script]c#K|jrd|jD}n|jg}t}|D]}t||D]}t j|}||vrtj d|z=| |t j |}t j |}t|||}||VdS)NcPg|]#}tj|!|$SrJ)r9r=exists)rLverss r@rNz3ScriptDirectory._load_revisions..s<7>>$''rBzJFile %s loaded twice! ignoring. Please ensure version_locations is unique.)r(rDrGsetScript _list_py_dirr9r=realpathrwarnaddbasenamedirname_from_filename) r?pathsdupesrU file_path real_pathfilenamedir_namescripts r@r7zScriptDirectory._load_revisions~s0  ! $ 3EE ]OE  D#00t<<   G,,Y77 %%I79BC )$$$7++I667??955..tXxHH>    rBconfigrc |d}|tjd|d}|t|}nd}|d}|r|d}ddtjdd d } ||}|t |} nGd ||D} n'#t$r} td |z| d} ~ wwxYwd} |d } | r6tt| tj dd<|ddk} ttj||dt ||ddk|dd| |d|di| |j S)zProduce a new :class:`.ScriptDirectory` given a :class:`.Config` instance. The :class:`.Config` need only have the ``script_location`` key present. script_locationNz0No 'script_location' key found in configuration.r&r(version_path_separator :;)Nspacer9rkrlcg|]}||SrJrJ)rLxs r@rNz/ScriptDirectory.from_config..s-)))a))))rBzV'%s' is not a valid value for version_path_separator; expected 'space', 'os', ':', ';'prepend_sys_pathrr1truer%r*r,r"r-post_write_hooks) r%r&r*r,r(r-r/r1r2)get_main_optionrr<intr9pathsep_split_on_space_commasplitKeyError ValueErrorlist_split_on_space_comma_colonsysr=r rK_default_file_template get_sectionr2) clsrfrhtslr&version_locations_strri split_on_path split_charr(kerprvls r@ from_configzScriptDirectory.from_configsp!001BCC  "#E $$%;<< ?#&s88 #' & 6 67J K K " %%+%;%;(&& " j M ,9*- %(=(C(C-))%%))#8#>#>z#J#J)))%%    79OP  "!% !112DEE  +112BCCCHRaRL$$%BCCvM  ,_ = = 00!7"6--l;;vE"223DgNN/++J77**+=rBB(+!0    sC C;#C66C;ancestormultiple_headsstartend resolutionIterator[None]c#`K dVdS#tj$r^}|tt|j}|tt|j}|sd}|||dz}t j||d}~wtj$rD}|sd}||p|j t j |j dz}t j||d}~wtj $r&}| d|j z}t j||d}~wtj $r%} t j| jd| d} ~ wwxYw)NzgRequested range %(start)s:%(end)s does not refer to ancestor/descendant revisions along the same branchrrzMultiple head revisions are present for given argument '%(head_arg)s'; please specify a specific target revision, '@%(head_arg)s' to narrow to a specific head, or 'heads' for all heads)head_argheadsz(Can't locate revision identified by '%s'r)rRangeNotAncestorErrorrrlowerupperrr< MultipleHeadsargumentformat_as_commarResolutionError RevisionErrorargs) r?rrrrrrnamhreerrs r@_catch_revision_errorsz&ScriptDirectory._catch_revision_errorss# : EEEEE- 7 7 7}S#),,{3 ** J E#">">>H#H--3 6% < < <! J,.2;-bh77//N#N33 ;' 8 8 8!GK #J//R 7% : : :#CHQK00c 9 :s9 D-AA22D-?CD-!C66D- D((D-baserheadc#K|||5|j||ddD]}tt|V ddddS#1swxYwYdS)a-Iterate through all revisions. :param base: the base revision, or "base" to start from the empty revision. :param head: the head revision; defaults to "heads" to indicate all head revisions. May also be "head" to indicate a single head revision. rTF) inclusiveassert_relative_lengthN)rr8iterate_revisionsrrW)r?rrrevs r@walk_revisionszScriptDirectory.walk_revisionss ( (t ( > > ( ((::dd5; ( (63'''''' ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (s9A!!A%(A%id_ _RevIdTypeTuple[Optional[Script], ...]c|5ttttdf|j|cdddS#1swxYwYdS)zReturn the :class:`.Script` instance with the given rev identifier, symbolic name, or sequence of identifiers. .N)rrrr rWr8 get_revisionsr?rs r@rzScriptDirectory.get_revisions-s  ( ( * *  hv&+,!//44                  sAA''A+.A+Tuple[str, ...]Set[Optional[Script]]c|5tttt|j|cdddS#1swxYwYdSN)rrr r rWr8_get_all_currentrs r@get_all_currentzScriptDirectory.get_all_current8s  ( ( * *  HV$%t'8'I'I#'N'N                  sAA%%A),A)Optional[Script]c|5ttt|j|cdddS#1swxYwYdS)zReturn the :class:`.Script` instance with the given rev id. .. seealso:: :meth:`.ScriptDirectory.get_revisions` N)rrr rWr8 get_revisionrs r@rzScriptDirectory.get_revision>s ( ( * * O O($*;*H*H*M*MNN O O O O O O O O O O O O O O O O O Os8AA!A%Optional[Union[str, Tuple[str, ...]]]c|5|j|\}}dddn #1swxYwY|sdS|dkr|S|dS)z[Convert a symbolic revision, i.e. 'head' or 'base', into an actual revision number.Nrr)rr8_resolve_revision_number)r?rr branch_names r@as_revision_numberz"ScriptDirectory.as_revision_numberJs  ( ( * * O O#0II#NN C O O O O O O O O O O O O O O O 4 G^^Jq6Ms?AAr!Union[str, Tuple[str, ...], None]rkwrc fttt|jj||fi|S)aIterate through script revisions, starting at the given upper revision identifier and ending at the lower. The traversal uses strictly the `down_revision` marker inside each migration script, so it is a requirement that upper >= lower, else you'll get nothing back. The iterator yields :class:`.Script` objects. .. seealso:: :meth:`.RevisionMap.iterate_revisions` )rrrWr8r)r?rrrs r@rz!ScriptDirectory.iterate_revisions[s;* V  /D  /u C C C C   rBc|d5|jcdddS#1swxYwYdS)aGReturn the current head revision. If the script directory has multiple heads due to branching, an error is raised; :meth:`.ScriptDirectory.get_heads` should be preferred. :return: a string revision number. .. seealso:: :meth:`.ScriptDirectory.get_heads` z}The script directory has multiple heads (due to branching).Please use get_heads(), or merge the branches using alembic merge.rN)rr8get_current_headrPs r@rz ScriptDirectory.get_current_headus ( (!)   8 8$5577 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8s=AA List[str]c4t|jjS)aUReturn all "versioned head" revisions as strings. This is normally a list of length one, unless branches are present. The :meth:`.ScriptDirectory.get_current_head()` method can be used normally when a script directory has only one head. :return: a tuple of string revision numbers. )rzr8rrPs r@ get_headszScriptDirectory.get_headssD%+,,,rBc|}t|dkrtjd|r|dSdS)a#Return the "base" revision as a string. This is the revision number of the script that has a ``down_revision`` of None. If the script directory has multiple bases, an error is raised; :meth:`.ScriptDirectory.get_bases` should be preferred. rz@The script directory has multiple bases. Please use get_bases().rN) get_basesrErr<)r?basess r@get_basezScriptDirectory.get_basesT   u::>>#*  8O4rBc4t|jjS)zreturn all "base" revisions as strings. This is the revision number of all scripts that have a ``down_revision`` of None. )rzr8rrPs r@rzScriptDirectory.get_basessD%+,,,rB destination current_revList[RevisionStep]cd|5||d}fdtt|DcdddS#1swxYwYdS)NzFDestination %(end)s is not a valid upgrade target from current head(s)rrT) implicit_basecZg|]'}tjj|(SrJ)r MigrationStepupgrade_from_scriptr8rLrer?s r@rNz1ScriptDirectory._upgrade_revs..sF';;%vrB)rrreversedrzr?rrrevss` r@ _upgrade_revszScriptDirectory._upgrade_revss ( (*)    ))[*D'tDzz22                   sAA&&A*-A*cd|5||d}fd|DcdddS#1swxYwYdS)NzHDestination %(end)s is not a valid downgrade target from current head(s)rT)select_for_downgradecZg|]'}tjj|(SrJ)rrdowngrade_from_scriptr8rs r@rNz3ScriptDirectory._downgrade_revs..sF'==%vrB)rrrs` r@_downgrade_revszScriptDirectory._downgrade_revss ( (*)    ))*D#                   s&A  AArList[StampStep]c d5|}g}|sd}g}tj|D]R}|rN|jttt||dStj |}|pdg}|D]}}|"|fd|D'||vr,tj |g} tj |g} | |r[| |rJd|D} tj| |jddj} || | |rEd |D} tj| |jddj} || Ftjd |jddj} || |cdddS#1swxYwYdS) NzCMultiple heads are present; please specify a single target revisionrrT)include_dependenciesc Tg|]$}tj|jdddj%S)NFT)rrrr8)rLrr?s r@rNz/ScriptDirectory._stamp_revs..sL   !%&/ $ $ % $ $ 1    rBcg|] }|j SrJrrLrs r@rNz/ScriptDirectory._stamp_revs..!K!K!KD$-!K!K!KrBFcg|] }|j SrJrrs r@rNz/ScriptDirectory._stamp_revs..(rrBrJ)rrrto_tupleextendr8filter_for_lineagerr rW unique_listrV_get_descendant_nodes_get_ancestor_nodes intersectionrrrappend) r?rr heads_revsstepsfiltered_headsrdestsdest descendants ancestors todo_headssteps ` r@ _stamp_revszScriptDirectory._stamp_revss< ( (%)  [ [  ++E22JE "!+-N}X..  ")))<< &!1:>>15="-n==N&&x00:TFE? ? <LL    )7      ^++"%;;TFCC   1 E Etf M MNN ++N;;" )55nEEEEE!K!KN!K!K!KJ$." ) DLL&&&++N;;"L!KN!K!K!KJ$." ) DLL&&&%.DM4t7HDLL&&&w[ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ sH3IIIc:tj|jddS)zRun the script environment. This basically runs the ``env.py`` script present in the migration environment. It is called exclusively by the command functions in :mod:`alembic.command`. env.pyN)rload_python_filer#rPs r@run_envzScriptDirectory.run_env=s dh11111rBctjtj|jdS)Nr)r9r=r>rOr#rPs r@env_py_locationzScriptDirectory.env_py_locationHs(wrw||DHh??@@@rBsrcrc tjdtj|fi|j5tj|||jfi|ddddS#1swxYwYdSNz Generating )rstatusr9r=r>r2template_to_filer,)r?rrrs r@_generate_templatez"ScriptDirectory._generate_templateLs [ 1"'//$// 1 1  595H   I I  !#tT-A H HR H H H I I I I I I I I I I I I I I I I I IsAA#&A#ctjdtj|fi|j5t j||ddddS#1swxYwYdSr)rrr9r=r>r2shutilcopy)r?rrs r@ _copy_filezScriptDirectory._copy_fileRs [ 1"'//$// 1 1  595H   # # KT " " " # # # # # # # # # # # # # # # # # #sAA"Ar=ctj|}tj|sIt jd|fi|j5tj|ddddS#1swxYwYdSdS)NzCreating directory )r9r=r>rTrrr2makedirs)r?r=s r@_ensure_directoryz!ScriptDirectory._ensure_directoryXswt$$w~~d## ",d,,040C " " D!!! " " " " " " " " " " " " " " " " " " " "sA;;A?A?datetime.datetimec|jttjdtj|j}|+tj|j}|tjd|jzt jtj  |}nt j }|S)Nz>The library 'python-dateutil' is required for timezone supportzCan't locate timezone: %s)tzinfo) r-rrr<gettzrdatetimeutcnowreplacetzutc astimezonenow)r?r  create_dates r@_generate_create_datez%ScriptDirectory._generate_create_date`s = $z'+ Xdm,,F~$-"5"5"7"788~'/$-?!((** ++F## K #+//11KrBrevidmessagerefreshspliceOptional[bool] branch_labels version_path depends_onOptional[_RevIdType]c |d} t|n7#tj$r%} t j| jd| d} ~ wwxYwd5tttddfj |} | D] } | dksJ dddn #1swxYwYtt| t| krt jd } |xtjd krY| D]A}|=t#|tsJt$j|j}nBt jd nj}t$jt$j|}jD]'}t$j||krn(t jd |zjr||||| }|s*| D]'}|#|jst jd |jz(|rW5dfdt j|DD}dddn #1swxYwYnd}jt$jjd|ftA|tj!tEd| Dt j#|tj!|| tj$||ndd| j%}|rtMj'|| t(|}n7#tj$r%} t j| jd| d} ~ wwxYw|dS|r/|j)s(t jd|jd|d|jdj *||S)aGenerate a new revision file. This runs the ``script.py.mako`` template, given template arguments, and creates a new file. :param revid: String revision id. Typically this comes from ``alembic.util.rev_id()``. :param message: the revision message, the one passed by the -m argument to the ``revision`` command. :param head: the head revision to generate against. Defaults to the current "head" if no branches are present, else raises an exception. :param splice: if True, allow the "head" version to not be an actual head; otherwise, the selected head must be a head (e.g. endpoint) revision. :param refresh: deprecated. Nrrz{Multiple heads are present; please specify the head revision on which the new revision should be based, or perform a merge.rr.rz"Duplicate head revisions specifiedrzAMultiple version locations present, please specify --version-pathz7Path %s is not represented in current version locationszeRevision %s is not a head revision; please specify --splice to create a new branch from this revisionc8g|]\}}||jvr|n|jSrJ)rr)rLrdeps r@rNz5ScriptDirectory.generate_revision..sE'''!Sc///C'''rBcbg|]+}tj||f,SrJ)rr8r)rLr r?s r@rNz5ScriptDirectory.generate_revision..sG%%%"$"3"@"@"E"EFFL%%%rBzscript.py.makoc3,K|]}||jndVdSrr)rLhs r@ z4ScriptDirectory.generate_revision..s,KKAMajjtKKKKKKrBz empty message) up_revision down_revisionrrrcommarzVersion z specified branch_labels z, however the migration file zb does not have them; have you upgraded your script.py.mako to include the 'branch_labels' section?)+rW verify_rev_idrrrr<rrrrr r8rrErVrrD isinstancer9r=r]rGnormpathr>r(r _rev_pathis_headto_listrrOr#r$tuple_rev_as_scalartuplerrr/r _run_hooks _from_pathr add_revision)r?rrrrrrrrrrrr#rhead_ norm_path vers_pathr=resolved_depends_onrrres` r@generate_revisionz!ScriptDirectory.generate_revisionysl< <D :   ' ' ' '% : : :#CHQK00c 9 : ( (&)  # #hz*C/0!//55E # #F{{{{{ # # # # # # # # # # # # # # # # s5zz??c%jj ( (#$HII I0022  4*++a//"  E()%88888')wuz'B'B ) +8 $} G$$RW__\%B%BCC 0  Iw **i778#$&23   ! 1  " "< 0 0 0~~lE7KHH   $U]$+M.)  ',,..  ''%%%%#'< #;#;%%% '''#               #'  GLL#3 4 4  E "6KKUKKKKK- 6634GHH#&&2GG   +  ;  "4)9 : : : :&&tT22FF% : : :#CHQK00c 9 : >4  !5 ## ???MMM6;;; @  &&v... sQ"A AA/AC  CC+KKK"N>>O2 O--O2rev_idrc t|}dt|pd}t ||jkr,|d|jddddz}d|j ||||j |j |j |j |j|jd zz}t j||S)N_rrz%s.py) rslugepochyearmonthdayhourminutesecond)rt timestamprO_slug_refindallrrEr&rsplitr%r>r?r@rArBrCr9r=)r?r=r8rrr=r<rcs r@r+zScriptDirectory._rev_path sK))++,,xx((B7788>>@@ t99t0 0 03$334;;CCCAFLD  #($*"#(%,%,     w||D(+++rB)r#r$r%r$r&r'r(r)r*r+r,r$r-r.r/r0r1r+r2rr3r4r3r$)r3rQ)rfrr3r )NNNNN) rr.rr.rr.rr.rr.r3r)rr)rr$rr$r3rQ)rrr3r)rrr3r)rr$r3r)rr.r3r)rrrrrrr3rQ)r3r.)r3r)rr$rr$r3r)rr$rr.r3r)rrrrr3r)r3r4)rr$rr$rrr3r4)rr$rr$r3r4)r=r$r3r4)r3r )NFFNNN)rr$rr.rr.rr+rrrr.rr.rrrrr3r) r=r$r8r$rr.rr r3r$)'__name__ __module__ __qualname____doc__r}rr EMPTY_DICTrApropertyrGmemoized_propertyrDr7 classmethodrrrrrrrrrrrrrrrrrrrrrrr7r+rJrBr@r r 5s,4.015 &"&37,1+/4 , ,      DX JJJ:N N N [N `#'(,#!$( +:+:+:+:^+:\/6(((((&     O O O O"    488880 - - - -,----$$^^^^@ 2 2 2 2AAXAIIII #### """":#!&'+&*+/QQQQQf,,,,,,rBr ceZdZUdZd%fd Zded< ded< dZd ed < ed&d Zed&d Z ed&dZ dZ d'd(dZ d)d*dZ d&dZed+dZed,d!Zed-d$ZxZS).rWzRepresent a single revision file in a ``versions/`` directory. The :class:`.Script` instance is returned by methods such as :meth:`.ScriptDirectory.iterate_revisions`. modulerr8r$r=c ||_||_t||jt jt|dddt jt|ddddS)NrrJ)defaultr)r dependencies)rRr=superrAr&rrgetattr)r?rRr8r= __class__s r@rAzScript.__init__1s      -66 d33R  rBNr_db_current_indicatorr3cBtjd|jdS))Return the docstring given in the script.z r)rrwlongdocrPs r@docz Script.docIsx --a00rBc|jj}|rHt|jdr||jj}|SdS)r[_alembic_source_encodingr;)rRrLhasattrdecoder_strip)r?r]s r@r\zScript.longdocOs[k!  t{$>?? jjK899;; 2rBcjd|j|jrdnd|jrdnd|jrdnd|jrdndd}|jr|d|dz }n|d |dz }|jr|d tj|jzz }|jr|d tj|j zz }|j r |d tj|j dz }|d |j dz }|dd d|j Dzz }|S)NzRev:  (head)r; (branchpoint) (mergepoint) (current) zMerges: zParent: zAlso depends on: %s zBranches into: %s zBranch names: zPath: z %s c3 K|] }d|zV dS)z %sNrJ)rLparas r@r$z#Script.log_entry..}s&LL$hoLLLLLLrB)rr,is_branch_pointis_merge_pointrY_format_down_revisionrUrrnextrevrr=rOr\ splitlines)r?entrys r@ log_entryzScript.log_entry]s MM -II2 - $ 4 <  " <#2 :OO : 6 >LLB > >     F Et'A'A'C'C'C'CE EEE Et'A'A'C'C'C'CE EE    ,$T%677 E    *$T\22 E    E$T%78888 E ,,  IILL$,2I2I2K2KLLL L L   rBc|d|j|jrdnd|jrdnd|jrdndd|jS)N -> rdr;rerfz, )rmrr,rkrlr]rPs r@__str__zScript.__str__si  & & ( ( ( ( MM -II2 - $ 4 <  " <#2 :OO : : HH   rBFTinclude_branchesr+ include_docinclude_parentstree_indicatorshead_indicatorsc|j}|rT|jr4|dtj|jd|}n|d|}|J|r&|jr|dtj|jzz }|s|r-||jrdnd|jr |jsdnd|jrdndz }|r||j rd nd|j rd ndz }|r |d |j zz }|S) Nz (z) -> rsz (%s)rdr;z (effective head)rgrerfz, %s) rrUrmrrr _is_real_headr,rYrkrlr])r?rurvrwrxrytexts r@ _head_onlyzScript._head_onlys}}  I  I..0000():;;;;D &*%?%?%A%A%A%A44H  G 2 G Gd243EFFF FD  o  !/7 R7<(,(:##!% :B B  D   $($8@  b@#'#6>B> D  & FTX% %D rBverbosecD|r|jS|||||Sr)rqr})r?r~rurvrwrxs r@ cmd_formatzScript.cmd_formats3  > !?? + rBcF|jsdStj|jS)Nz)r&rr_versioned_down_revisionsrPs r@rmzScript._format_down_revisions'! H8'(FGG GrB scriptdirr rcttj|\}}||||Sr)r9r=rwr^)rrr=dir_rcs r@r1zScript._from_paths3t,,h!!)T8<<z&Script._list_py_dir..s)JJJX^^C003JJJrBc3K|]A}|ddvtj|VBdS)rrN)rwr9r=rO)rLpycnames py_cache_paths r@r$z&Script._list_py_dir..sY!!99S>>!,E99 ]C889999!!rB) r9walkendswithsortedrr=rOr*rTrlistdirr1sort) rrr=r_rootdirsfilesrcrrs @@r@rXzScript._list_py_dirs@!#t!>-00 KJEJJJELL!!!!!#%:m#<#<!!! 8  IIKKKK rBrrcc|jrt|}nt|}|sdS|d}|jr3|ddk}|ddk}ndx}}|s|rt jt j||}t jt j||dz} |s|r| rdStj ||} t| dsIt|} | stj d|z| d} n| j} t| | t j||S)NrrcoFrzCould not determine revision id from filename %s. Be sure the 'revision' variable is declared inside the script (please see 'Upgrading from Alembic 0.1 to 0.2' in the documentation).)r*_sourceless_rev_filematch_only_source_rev_filegroupr9r=rTrOrrr` _legacy_revr<rrW) rrrrcpy_match py_filenameis_cis_o py_exists pyc_existsrRmrs r@r^zScript._from_filenames   =+11(;;HH,228<>!$$+D>>!$$+DD D4  4 rw||D+'F'FGGI T;;L(M(MNNJ  D Z t&tX66vz** '!!(++A &'F 771::Hfh T8(D(DEEErB)rRrr8r$r=r$rH)FFFTT) rur+rvr+rwr+rxr+ryr+r3r$)FFFT) r~r+rur+rvr+rwr+rxr+r3r$)rr r=r$r3r)rr r=r$r3r)rr rr$rcr$r3r)rIrJrKrLrA__annotations__rYrNr]r\rqrtr}rrmrPr1rXr^ __classcell__)rXs@r@rWrW(s       B III(,000004111X1    X !!!X!F   "'! % $ $ $$$$$R"'! % $     HHHH ===[= """["H/F/F/F[/F/F/F/F/FrBrW)6 __future__r contextlibrr r9rrr|typesrtypingrrrr r r r r rrrr;rrrruntimerrrfrrruntime.migrationrrscript.revisionrdateutilr ImportErrorr$rcompilerrr _mod_def_rerEr}rvr{r rWrJrBr@rs?""""""%%%%%%  +))))))000000------****** BBB3 % & !rz"EFF" #@AAbj,-- bj;<< 2:f  +" =11(bj)9::p ,p ,p ,p ,p ,p ,p ,p ,fzFzFzFzFzFX zFzFzFzFzFs(B//B98B9