ÿØÿà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@s:ddlmZddlmZdefdYZdS(i(tutil(topstRewritercBseZdZejZd ZdZdZ dZ dZ dZ ej ejdZej ejdZej ejdZd Zd Zd ZRS( sPA helper object that allows easy 'rewriting' of ops streams. The :class:`.Rewriter` object is intended to be passed along to the :paramref:`.EnvironmentContext.configure.process_revision_directives` parameter in an ``env.py`` script. Once constructed, any number of "rewrites" functions can be associated with it, which will be given the opportunity to modify the structure without having to have explicit knowledge of the overall structure. The function is passed the :class:`.MigrationContext` object and ``revision`` tuple that are passed to the :paramref:`.Environment Context.configure.process_revision_directives` function normally, and the third argument is an individual directive of the type noted in the decorator. The function has the choice of returning a single op directive, which normally can be the directive that was actually passed, or a new directive to replace it, or a list of zero or more directives to replace it. .. seealso:: :ref:`autogen_rewriter` - usage example .. versionadded:: 0.8 cCstj|_dS(N(Rt Dispatchertdispatch(tself((sN/opt/alt/python27/lib/python2.7/site-packages/alembic/autogenerate/rewriter.pyt__init__%scCs5|jj|j}|jj|j||_|S(sProduce a "chain" of this :class:`.Rewriter` to another. This allows two rewriters to operate serially on a stream, e.g.:: writer1 = autogenerate.Rewriter() writer2 = autogenerate.Rewriter() @writer1.rewrites(ops.AddColumnOp) def add_column_nullable(context, revision, op): op.column.nullable = True return op @writer2.rewrites(ops.AddColumnOp) def add_column_idx(context, revision, op): idx_op = ops.CreateIndexOp( 'ixc', op.table_name, [op.column.name]) return [ op, idx_op ] writer = writer1.chain(writer2) :param other: a :class:`.Rewriter` instance :return: a new :class:`.Rewriter` that will run the operations of this writer, then the "other" writer, in succession. (t __class__t__new__t__dict__tupdatet_chained(Rtothertwr((sN/opt/alt/python27/lib/python2.7/site-packages/alembic/autogenerate/rewriter.pytchain(s cCs|jj|S(sRegister a function as rewriter for a given type. The function should receive three arguments, which are the :class:`.MigrationContext`, a ``revision`` tuple, and an op directive of the type indicated. E.g.:: @writer1.rewrites(ops.AddColumnOp) def add_column_nullable(context, revision, op): op.column.nullable = True return op (Rt dispatch_for(Rtoperator((sN/opt/alt/python27/lib/python2.7/site-packages/alembic/autogenerate/rewriter.pytrewritesKs ccsdy|jj|}Wntk r4d}|Vn,Xx(tj||||D] }|VqQWdS(N(Rt ValueErrortNoneRtto_list(Rtcontexttrevisiont directivet _rewritert r_directive((sN/opt/alt/python27/lib/python2.7/site-packages/alembic/autogenerate/rewriter.pyt_rewriteZs   cCs6|j||||jr2|j|||ndS(N(tprocess_revision_directivesR (RRRt directives((sN/opt/alt/python27/lib/python2.7/site-packages/alembic/autogenerate/rewriter.pyt__call__es c Csg}x[|jD]P}|j|||j}t|dkrOtdn|j|dqW||_g}x[|jD]P}|j|||j}t|dkrtdn|j|dq}W||_dS(Nis5Can only return single object for UpgradeOps traverseis7Can only return single object for DowngradeOps traverse(tupgrade_ops_listt _traverse_fort upgrade_opstlenRtappendtdowngrade_ops_listt downgrade_ops( RRRRRR tretR#R$((sN/opt/alt/python27/lib/python2.7/site-packages/alembic/autogenerate/rewriter.pyt_traverse_scriptjs"   cCs|j|||jdS(N(t_traverse_listR(RRRR((sN/opt/alt/python27/lib/python2.7/site-packages/alembic/autogenerate/rewriter.pyt_traverse_op_containerscCsdS(N((RRRR((sN/opt/alt/python27/lib/python2.7/site-packages/alembic/autogenerate/rewriter.pyt_traverse_any_directivescCsUt|j|||}x3|D]+}|jj|}|||||q"W|S(N(tlistRt _traverseR(RRRRRt traverser((sN/opt/alt/python27/lib/python2.7/site-packages/alembic/autogenerate/rewriter.pyRs  cCs>g}x*|D]"}|j|j|||q W||(dS(N(textendR(RRRRtdestR((sN/opt/alt/python27/lib/python2.7/site-packages/alembic/autogenerate/rewriter.pyR's  cCs|j|||dS(N(R'(RRRR((sN/opt/alt/python27/lib/python2.7/site-packages/alembic/autogenerate/rewriter.pyRsN(t__name__t __module__t__doc__RRR+RR RRRRRRRtMigrationScriptR&t OpContainerR(tMigrateOperationR)RR'R(((sN/opt/alt/python27/lib/python2.7/site-packages/alembic/autogenerate/rewriter.pyRs   #    N(talembicRtalembic.operationsRtobjectR(((sN/opt/alt/python27/lib/python2.7/site-packages/alembic/autogenerate/rewriter.pyts