ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ M!Vc@sddlZddlZddlmZddlmZddlmZejdZde fdYZ de fd YZ d e fd YZ d e fd YZ defdYZdefdYZdZdS(iNi(tutil(tcompats(?:(.+?)@)?(\w+)?((?:\+|-)\d+)t RevisionErrorcBseZRS((t__name__t __module__(((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR stRangeNotAncestorErrorcBseZdZRS(cCsB||_||_tt|jd|p-d|p6dfdS(Ns-Revision %s is not an ancestor of revision %stbase(tlowertuppertsuperRt__init__(tselfRR((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR s   (RRR (((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyRst MultipleHeadscBseZdZRS(cCs?||_||_tt|jd|dj|fdS(Ns6Multiple heads are present for given argument '%s'; %ss, (theadstargumentR R R tjoin(R R R((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR s   (RRR (((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR stResolutionErrorcBseZdZRS(cCs#tt|j|||_dS(N(R RR R(R tmessageR((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR $s(RRR (((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR#st RevisionMapcBsReZdZdZejdZejdZejdZejdZ ejdZ dZ e dZ d Zed Zdd Zd Zd ZdZdZddZedZedZdZdZeee dZdee dZdee dZedZe edZ RS(sMaintains a map of :class:`.Revision` objects. :class:`.RevisionMap` is used by :class:`.ScriptDirectory` to maintain and traverse the collection of :class:`.Script` objects, which are themselves instances of :class:`.Revision`. cCs ||_dS(s Construct a new :class:`.RevisionMap`. :param generator: a zero-arg callable that will generate an iterable of :class:`.Revision` instances to be used. These are typically :class:`.Script` subclasses within regular Alembic use. N(t _generator(R t generator((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR 2scCs|j|jS(sAll "head" revisions as strings. This is normally a tuple of length one, unless unmerged branches are present. :return: a tuple of string revision numbers. (t _revision_mapR (R ((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR <s cCs|j|jS(sAll "base" revisions as strings. These are revisions that have a ``down_revision`` of None, or empty tuple. :return: a tuple of string revision numbers. (Rtbases(R ((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyRIs cCs|j|jS(seAll "real" head revisions as strings. :return: a tuple of string revision numbers. (Rt _real_heads(R ((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyRVscCs|j|jS(seAll "real" base revisions as strings. :return: a tuple of string revision numbers. (Rt _real_bases(R ((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR`sc CsQi}tj}tj}d|_d|_t}t}x|jD]}|j|kr{tjd|jn|||j<|j r|j |n|j r|j |n|j |j|j |j|j r|j|jf7_n|j rO|j|jf7_qOqOWx|D]}|j||q'Wx|D]}|j||qHWx|jD]}xz|jD]o}||krtjd||fn||} | j|||jkr|j|n|j|qWqoWd|d<|ds(R!R,Rtto_tuplet_resolved_dependencies(R RR/((R/sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR%s  cs|j}| r6j|kr6tjdjn+|raj|kratdjn|j<|j||j|jr|jjf7_nj r|j jf7_ nxHj D]=}||krtjd|fn||j qWj rStfd|jDjf|_njrtfd|jDjf|_ndS(sadd a single revision to an existing map. This method is for single-revision use cases, it's not appropriate for fully populating an entire revision map. s%Revision %s is present more than oncesrevision %s not in maps-Revision %s referenced from %s is not presentc3s9|]/}|tjjjgkr|VqdS(N(RR'tunionR(R>thead(R(sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys sc3s9|]/}|tjjjgkr|VqdS(N(RR)RBR(R>RC(R(sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys sN(RRRRt ExceptionR-R%R"RR#RR'R(t _is_real_headR,Rtis_headR (R Rt_replaceR/R3((RsH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyt add_revisions6        cCsn|j}|r$|j||}nt|dkrXt||rLd|ndn|rf|dSdSdS(sReturn 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. :param branch_label: optional branch name which will limit the heads considered to those which include that branch_label. :return: a string revision number. .. seealso:: :meth:`.ScriptDirectory.get_heads` is%s@headRCiN(R tfilter_for_lineagetlenR R+(R R6t current_heads((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pytget_current_heads cCs|j|j|S(N(RIR(R t identifier((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyt_get_base_revisionsscszt|ttttfrDtg|D]}j|^q%dSj|\}tfd|DSdS(sReturn the :class:`.Revision` instances with the given rev id or identifiers. May be given a single identifier, a sequence of identifiers, or the special symbols "head" or "base". The result is a tuple of one or more identifiers, or an empty tuple in the case of "base". In the cases where 'head', 'heads' is requested and the revision map is empty, returns an empty tuple. Supports partial identifiers, where the given identifier is matched against all identifiers that start with the given characters; if there is exactly one match, that determines the full revision. c3s!|]}j|VqdS(N(t_revision_for_ident(R>trev_id(R6R (sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys /sN((t isinstancetlistR,Rt frozensettsumt get_revisionst_resolve_revision_number(R tid_tid_elemt resolved_id((R6R sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyRUs )cCs\|j|\}}t|dkr9t||n|rL|d}n|j||S(s Return the :class:`.Revision` instance with the given rev id. If a symbolic name such as "head" or "base" is given, resolves the identifier into the current head or base revision. If the symbolic name refers to multiples, :class:`.MultipleHeads` is raised. Supports partial identifiers, where the given identifier is matched against all identifiers that start with the given characters; if there is exactly one match, that determines the full revision. ii(RVRJR RO(R RWRYR6((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyt get_revision2s  cCsky|j|}WnOtk rby|j|}Wn$tk rZtd||qgX|SnX|SdS(NsNo such branch: '%s'(RtKeyErrorROR(R R6t branch_revt nonbranch_rev((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyt_resolve_branchHs  cCsT|r|j|}nd}y|j|}Wntk rg|jD]!}|rI|j|rI|^qI}|r|j||}n|std||qt|dkrtd|djd|dd!Df|q|j|d}nX|rP|dk rP|j |j |j sPtd|j |f|qPn|S( NsNo such revision or branch '%s'is)Multiple revisions start with '%s': %s...s, css|]}d|VqdS(s'%s'N((R>tr((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys msiis*Revision %s is not a member of branch '%s'( R^R+RR[t startswithRIRRJRt_shares_lineageR(R RYt check_branchR\Rtxtrevs((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyROVs8 ! ! cCsv|j|\}}g}|r1|j|n|rG|j|ng|D]$}|j||d|rN|^qNS(NR7(RVtappendtextendRa(R ttargetst check_againstR7RWR6tsharesttg((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyRIzs cCs|s tSt|ts+|j|}ngtj|ddD]*}t|tse|j|n|^qA}tt|j|gd|j |j |gd|j |S(NtdefaultR7(( tTrueRQtRevisionRORR@tboolRR9RBt_get_ancestor_nodest intersection(R ttargetttest_against_revsR7ttest_against_rev((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyRasC  cCst|tjr9d|kr9|jdd\}}nd}|j|dkr|rq|j|j||fS|j|fSnv|dkr|j |}|r|f|fSd|fSn;|dks|dkrd|fSt j |dd|fSdS( Nt@iR RCRRk((( RQRt string_typestsplitR+RRIR RRLRR@(R RWR6t current_head((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyRVs"     cCst|tjr.tj|}|s2dSndSt|jd}|jd} |jd} |rx| rxdnd} |r| rd| } n1| r| jdr| } qd| } nd} |} n2| rd| } n| rd| } nd} |} t |j | | d |d |}| r| rO|j d | | f}n|j | }| jdrvd}q| dkrt |d}qtj t |ddd }x7|D] }|j||jkrPqqWd}nd}|rQ|||| }| r|rt |t|| krtd |t|fqn]|d||| !}| r|rt |t|| krtd |t|fnt|S(Niiiis%s@headRCs%s@baseRt inclusivet implicit_bases%s@%sis1Relative revision %s didn't produce %d migrations(RQRRut_relative_destinationtmatchR+tinttgroupR`RRt_iterate_revisionsRZRJtrangeRtabsRtiter(R t destinationtsourcet is_upwardsRyRxtassert_relative_lengthR{trelativetsymbolR6treldeltatfrom_tto_Rdt symbol_revtindextrange_((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyt_relative_iteratesr             cCsl|j||t|||}|r(|S|j||t|||}|rP|S|j||d|d|S(suIterate 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:`.Revision` objects. RxRy(RRlR.R~(R RRRyRxRtrelative_uppertrelative_lower((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pytiterate_revisionss    cCs7|rd}n d}|j||d|d|S(NcSs|jS(N(t _all_nextrev(R2((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyt*tcSs|jS(N(tnextrev(R2((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR,RR/tcheck(t_iterate_related_revisions(R RgR/RR7tfn((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR9&s   cCs7|rd}n d}|j||d|d|S(NcSs|jS(N(R'(R2((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR6RcSs|jS(N(R)(R2((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR8RR/R(R(R RgR/RR7R((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyRo2s   c #sdkr|jnt}tj}x|D]}|j||rYt}nxs|r|j} |r|j| n| |krq\n|j| |jfd|| D| Vq\W|r4|j |j |gr4t d|j q4q4WdS(Nc3s|]}|VqdS(N((R>RP(R/(sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys Sss=Requested revision %s overlaps with other requested revisions( R+RRt collectionstdequeRetpopR RfRpt differenceRR( R RRgR/RtseenttodoRqt per_targetR2((R/sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR>s,            !c#s_j|}t|tjo-|jd}tjj|}| rb| rbtntj |dt }|rjj |} n |rP|rPtj |} tj |} t} |j | j | } xF| D]>}x5|jD]}j|| kr Pq q W| j|qW| j|} nW|rtjj} | j|} n'|stjj} n|} td|Djdj | dt Dst||ntfdfdDD}tjfd|D}t }xrM|sftdnt}|s|jtfd |Dd d |j|nx|rI|j}j|jt }|jgt|jD]2}j||kr|krj|^q| rA||krAqn|VqWqKW| s[t d S( siterate revisions from upper to lower. The traversal is depth-first within branches, and breadth-first across branches as a whole. s@baseRcss|]}|jVqdS(N(R(R>R2((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys scss|]}|jVqdS(N(R(R>R2((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys sc3s<|]2}|jrtj|jdkr|VqdS(iN(R:RJRpR(R>R2(t total_space(sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys s c3s|]}j|VqdS(N(R(R>R2(R (sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys sc3s$|]}|jkr|VqdS(N(R(R>R_(R(sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys ss5Dependency resolution failed; iteration can't proceedc3s'|]}|jjs|VqdS(N(RRp(R>R2(R(sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys stkeycSs|jr dSdS(Nii(tis_branch_point(R2((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyRRN(!RURQRRutendswithRt dedupe_tuplet StopIterationRRoRlRNR9RR'RR RBRRpRRRRR.t extendlefttsortedtdifference_updatetpoplefttremoveRtreversedtAssertionError(R RRRxRytrequested_lowerstlimit_to_lower_branchtupperstupper_ancestorstlowerstlower_ancestorstlower_descendantst base_lowerstcandidate_lowersR2R3t branch_todoRttotal_space_modified((R RsH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR~Zs !               N(!RRt__doc__R Rtmemoized_propertyR RRRRR$RlR-R%R.RHR+RLRNRURZR^RORIRaRVRRR9RoRR~(((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR)s6     ;   *      %    N   RmcBseZdZeZeZd Zd Zd Z d Z d d dZ dZ dZ edZedZedZedZedZed Zed Zed Zed ZRS(soBase class for revisioned objects. The :class:`.Revision` class is the base of the more public-facing :class:`.Script` object, which represents a migration script. The mechanics of revision management and traversal are encapsulated within :class:`.Revision`, while :class:`.Script` applies this logic to Python files in a version directory. cCs^||_t||_t||_d|_tj|dd|_t|j|_ dS(NRk((( Rttuple_rev_as_scalarR4R!RARR@R5RR(R RR4R!R((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR s   cCs{t|jt|jg}|jr>|jd|jn|jr^|jd|jnd|jjdj|fS(Nsdependencies=%rsbranch_labels=%rs%s(%s)s, ( treprRR4R!ReRt __class__RR(R targs((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyt__repr__ s    cCsO|jj|jg|_|j|jkrK|jj|jg|_ndS(N(RRBRR)R(R R((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR(scCstj|jdd|jS(NRk((RR@R4RA(R ((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR'scCstj|jddS(NRk((RR@R4(R ((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR)!scCst|j S(sReturn True if this :class:`.Revision` is a 'head' revision. This is determined based on whether any other :class:`.Script` within the :class:`.ScriptDirectory` refers to this :class:`.Script`. Multiple heads can be present. (RnR(R ((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyRF%s cCst|j S(N(RnR(R ((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyRE0scCs |jdkS(s<Return True if this :class:`.Revision` is a 'base' revision.N(R4R+(R ((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR"4scCs|jdko|jdkS(srReturn True if this :class:`.Revision` is a "real" base revision, e.g. that it has no dependencies either.N(R4R+R!(R ((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR#:scCst|jdkS(s+Return True if this :class:`.Script` is a branch point. A branchpoint is defined as a :class:`.Script` which is referred to by more than one succeeding :class:`.Script`, that is more than one :class:`.Script` has a `down_revision` identifier pointing here. i(RJR(R ((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyRDs cCst|jdkS(szReturn True if this :class:`.Script` is a 'real' branch point, taking into account dependencies as well. i(RJR(R ((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR:PscCst|jdkS(s6Return True if this :class:`.Script` is a merge point.i(RJR)(R ((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR;XsN(RRRRSRRR+RR4R!RR RR(tpropertyR'R)RFRER"R#RR:R;(((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyRms&         cCs,|s dSt|dkr$|dS|SdS(Nii(R+RJ(R2((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR_s (treRRRt sqlalchemyRRtcompileRzRDRRR RtobjectRRmR(((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyts