%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib/python2.7/site-packages/alembic/script/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyc

�
�M!Vc@s�ddlZddlZddlmZddlmZddlmZejd�Zde	fd��YZ
de
fd	��YZd
e
fd��YZde
fd
��YZ
defd��YZdefd��YZd�ZdS(i����Ni(tutil(tcompats(?:(.+?)@)?(\w+)?((?:\+|-)\d+)t
RevisionErrorcBseZRS((t__name__t
__module__(((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyRstRangeNotAncestorErrorcBseZd�ZRS(cCsB||_||_tt|�jd|p-d|p6df�dS(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
MultipleHeadscBseZd�ZRS(cCs?||_||_tt|�jd|dj|�f�dS(Ns6Multiple heads are present for given argument '%s'; %ss, (theadstargumentR	RR
tjoin(RR
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stResolutionErrorcBseZd�ZRS(cCs#tt|�j|�||_dS(N(R	RR
R(RtmessageR((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#stRevisionMapcBsReZdZd�Zejd��Zejd��Zejd��Zejd��Z	ejd��Z
d�Zed�Z
d	�Zed
�Zdd�Zd�Zd
�Zd�Zd�Zdd�Zed�Zed�Zd�Zd�Zeeed�Zdeed�Zdeed�Zed�Zeed�Z RS(s�Maintains 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(Rt	generator((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR
2scCs|j|jS(s�All "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(s�All "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�|j�D]�}|j|kr{tjd|j�n|||j<|j	r�|j
|�n|jr�|j
|�n|j
|j�|j
|j�|jr�|j|jf7_n|j
rO|j|jf7_qOqOWx|D]}|j||�q'Wx|D]}|j||�qHWx�|j�D]�}xz|jD]o}||kr�tjd||f�n||}	|	j|�||jkr�|j|�n|j|�qWqoWd|d<|d<t|�|_t|�|_x$|D]}|j||dt�q-W|S(s_memoized attribute, initializes the revision map from the
        initial collection.

        s%Revision %s is present more than onces-Revision %s referenced from %s is not presenttmap_branch_labels((N((tsqlautilt
OrderedSetRRtsetRtrevisionRtwarnt
branch_labelstaddtdependenciestis_baset
_is_real_baset_map_branch_labelst_add_depends_ontvaluest_all_down_revisionstadd_nextrevt_versioned_down_revisionstdiscardtNonettupleR
Rt
_add_branchestFalse(
Rtmap_R
Rthas_branch_labelsthas_depends_onRtrevtdownrevt
down_revision((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyRjsT					
				

	


cCs`|jr\xP|jD]B}||krKtd||j||jf��n|||<qWndS(Ns;Branch name '%s' in revision %s already used by revision %s(Rt_orig_branch_labelsRR(RRR/tbranch_label((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR$�s		cCs�|r|j||�n|jr�|jj|j�x6|j|g|dt�D]}|jj|j�qQW|}xN|r�|jr�|jr�|jj|j�|jr�||j}qwPqwWndS(Ntinclude_dependencies(R$Rtupdatet_get_descendant_nodesR.t_is_real_branch_pointtis_merge_pointR4(RRR/Rtnodetparent((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR-�s			

	cs;|jr7t�fd�tj|j�D��|_ndS(Nc3s|]}�|jVqdS(N(R(t.0tdep(R/(sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys	<genexpr>�s(R!R,Rtto_tuplet_resolved_dependencies(RRR/((R/sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR%�s	cs�|j}|r6�j|kr6tjd�j�n+|ra�j|kratd�j��n�|�j<|j�|�|j�|��jr�|j�jf7_n�j	r�|j
�jf7_
nxH�jD]=}||krtjd|�f�n||j��q�W�j
rSt�fd�|jD���jf|_n�jr�t�fd�|jD���jf|_ndS(s�add 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|]/}|t�j�j�jg�kr|VqdS(N(RR'tunionR(R>thead(R(sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys	<genexpr>�sc3s9|]/}|t�j�j�jg�kr|VqdS(N(RR)RBR(R>RC(R(sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys	<genexpr>�sN(RRRRt	ExceptionR-R%R"RR#RR'R(t
_is_real_headR,Rtis_headR
(RRt_replaceR/R3((RsH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pytadd_revision�s6		
				cCsn|j}|r$|j||�}nt|�dkrXt||rLd|nd��n|rf|dSdSdS(s�Return 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+(RR6t
current_heads((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pytget_current_head�s	cCs|j|j|�S(N(RIR(Rt
identifier((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyt_get_base_revisionsscszt|ttttf�rDtg|D]}�j|�^q%d�S�j|�\}�t��fd�|D��SdS(s�Return 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	<genexpr>/sN((t
isinstancetlistR,Rt	frozensettsumt
get_revisionst_resolve_revision_number(Rtid_tid_elemtresolved_id((R6RsH/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(RRWRYR6((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(RR6t
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|}Wn�tk
rg|jD]!}|rI|j|�rI|^qI}|r�|j||�}n|s�td||��qt|�dkr�td|djd�|dd!D��f|��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	<genexpr>msiis*Revision %s is not a member of branch '%s'(R^R+RR[t
startswithRIRRJRt_shares_lineageR(RRYt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(Rttargetst
check_againstR7RWR6tsharesttg((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyRIzs
cCs�|s
tSt|t�s+|j|�}ngtj|dd�D]*}t|t�se|j|�n|^qA}tt|j|gd|��j	|j
|gd|��j|��S(NtdefaultR7((tTrueRQtRevisionRORR@tboolRR9RBt_get_ancestor_nodestintersection(Rttargetttest_against_revsR7ttest_against_rev((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyRa�sCcCs�t|tj�r9d|kr9|jdd�\}}nd}|j|dkr�|rq|j|j|�|fS|j|fSnv|dkr�|j	|�}|r�|f|fSd|fSn;|dks�|dkr�d|fSt
j|dd�|fSdS(	Nt@iR
RCRRk(((RQRtstring_typestsplitR+RRIR
RRLRR@(RRWR6tcurrent_head((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyRV�s"


c	Cs�t|tj�r.tj|�}|s2dSndSt|jd��}|jd�}	|jd�}
|rx|	rxdnd}|r�|
r�d|
}n1|	r�|	jd�r�|	}q�d|	}nd}|}
n2|
r�d|
}
n|	r�d|	}
nd}
|}t	|j
||
d	|d
|��}|	r�|
rO|jd|
|	f�}n|j|	�}|	jd�rvd}q�|	dkr�t|�d}q�tj
t|�ddd�}x7|D] }|j||jkr�Pq�q�Wd}nd}|rQ||||}|r�|r�t|�t||�kr�td
|t|�f��q�n]|d|||!}|r�|r�t|�t|�|kr�td
|t|�f��nt|�S(Niiiis%s@headRCs%s@baseRt	inclusivet
implicit_bases%s@%si����s1Relative revision %s didn't produce %d migrations(RQRRut_relative_destinationtmatchR+tinttgroupR`RRt_iterate_revisionsRZRJtrangeRtabsRtiter(Rtdestinationtsourcet
is_upwardsRyRxtassert_relative_lengthR{trelativetsymbolR6treldeltatfrom_tto_Rdt
symbol_revtindextrange_((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyt_relative_iterate�sr
	
	

		
	

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(R�RlR.R~(RRRRyRxR�trelative_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<lambda>*scSs|jS(N(tnextrev(R2((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR�,sR/tcheck(t_iterate_related_revisions(RRgR/R�R7tfn((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.pyR�6scSs|jS(N(R)(R2((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR�8sR/R�(R�(RRgR/R�R7R�((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyRo2s
	c
#s�dkr|j�nt�}tj�}x�|D]�}|j|�|rYt�}nxs|r�|j�}	|r�|j|	�n|	|kr�q\n|j|	�|j�fd�||	�D��|	Vq\W|r4|j	|�j
|g�r4td|j��q4q4WdS(Nc3s|]}�|VqdS(N((R>RP(R/(sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys	<genexpr>Sss=Requested revision %s overlaps with other requested revisions(
R+RRtcollectionstdequeRetpopR RfRpt
differenceRR(
RR�RgR/R�tseenttodoRqt
per_targetR2((R/sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR�>s,	

	
	!c	#s_�j|�}t|tj�o-|jd�}tj�j|��}|rb|rbt��nt�j	|dt
��}|r��j�j|��}	n	|rP|rPt�j	|��}
t�j|��}t�}|j
|
�j
|�}
xF|
D]>}x5|jD]}�j||
krPqqW|j|�q�W|j|�}	nW|r�t�j�j��}|j|�}	n'|s�t�j�j��}	n|}	td�|D��jd��j|	dt
�D����s�t||��nt�fd��fd��D�D��}tj�fd�|D��}t
}x�rM|sftd��nt}|s�|jt�fd	�|D�d
d���|j|�nx�|rI|j�}�j|j�t
}|jgt|j�D]2}�j||kr�|�kr��j|^q��|rA||krAq�n|Vq�WqKW|s[t �dS(
s�iterate revisions from upper to lower.

        The traversal is depth-first within branches, and breadth-first
        across branches as a whole.

        s@baseR�css|]}|jVqdS(N(R(R>R2((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys	<genexpr>�scss|]}|jVqdS(N(R(R>R2((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys	<genexpr>�sc3s<|]2}|jrt�j|j��dkr|VqdS(iN(R:RJRpR�(R>R2(ttotal_space(sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys	<genexpr>�s	c3s|]}�j|VqdS(N(R(R>R2(R(sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys	<genexpr>�sc3s$|]}|j�kr|VqdS(N(R(R>R_(R�(sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys	<genexpr>�ss5Dependency resolution failed; iteration can't proceedc3s'|]}|jj��s|VqdS(N(R�Rp(R>R2(R�(sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pys	<genexpr>�stkeycSs|jr
dSdS(Nii(tis_branch_point(R2((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR��sN(!RURQRRutendswithRtdedupe_tuplet
StopIterationRRoRlRNR9R�R'RR RBRRpRR�R�RR.t
extendlefttsortedtdifference_updatetpoplefttremoveRtreversedtAssertionError(RRRRxRytrequested_lowerstlimit_to_lower_branchtupperstupper_ancestorstlowerstlower_ancestorstlower_descendantstbase_lowerstcandidate_lowersR2R3tbranch_todoR�ttotal_space_modified((RR�sH/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^RORIRaRVR�R�R9RoR�R~(((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR)s6	




;		*				%		NRmcBs�eZdZe�Ze�Zd
Zd
Zd
Z	d
Z
d
d
d�Zd�Zd�Z
ed��Zed��Zed��Zed��Zed��Zed	��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(RRR4R!R((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR
�s		cCs{t|j�t|j�g}|jr>|jd|j�n|jr^|jd|j�nd|jjdj|�fS(Nsdependencies=%rsbranch_labels=%rs%s(%s)s, (	treprRR4R!ReRt	__class__RR(Rtargs((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyt__repr__	s			cCsO|jj|jg�|_|j|jkrK|jj|jg�|_ndS(N(R�RBRR)R�(RR((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|jdd�S(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|j�dkS(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.pyR�Ds
cCst|j�dkS(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|j�dkS(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(RRR�RSR�R�R+RR4R!RR
R�R(tpropertyR'R)RFRER"R#R�R:R;(((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyRm�s&			
		
cCs,|s
dSt|�dkr$|dS|SdS(Nii(R+RJ(R2((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyR�_s
(treR�tRt
sqlalchemyRRtcompileRzRDRRRRtobjectRRmR�(((sH/opt/alt/python27/lib/python2.7/site-packages/alembic/script/revision.pyt<module>s

����

Zerion Mini Shell 1.0