%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/227033/root/opt/alt/python27/lib/python2.7/site-packages/alembic/
Upload File :
Create Path :
Current File : //proc/227033/root/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pyo

�
�M!Vc@s�ddlmZddlmZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddl	mZd	efd
��YZ
defd��YZddd
�Zedkr�e�ndS(i����(tArgumentParseri(tSafeConfigParserN(tcommand(tutil(tpackage_dir(tcompattConfigcBs�eZdZd
dd
ejd
ej�d
d�Zd
Z	d
Z
d
Zejd��Z
d�Zejd��Zd�Zd�Zd�Zd	�Zd
�Zd
d�Zd
d�ZRS(sk
Represent an Alembic configuration.

    Within an ``env.py`` script, this is available
    via the :attr:`.EnvironmentContext.config` attribute,
    which in turn is available at ``alembic.context``::

        from alembic import context

        some_param = context.config.get_main_option("my option")

    When invoking Alembic programatically, a new
    :class:`.Config` can be created by passing
    the name of an .ini file to the constructor::

        from alembic.config import Config
        alembic_cfg = Config("/path/to/yourapp/alembic.ini")

    With a :class:`.Config` object, you can then
    run Alembic commands programmatically using the directives
    in :mod:`alembic.command`.

    The :class:`.Config` object can also be constructed without
    a filename.   Values can be set programmatically, and
    new sections will be created as needed::

        from alembic.config import Config
        alembic_cfg = Config()
        alembic_cfg.set_main_option("script_location", "myapp:migrations")
        alembic_cfg.set_main_option("url", "postgresql://foo/bar")
        alembic_cfg.set_section_option("mysection", "foo", "bar")

    For passing non-string values to environments, such as connections and
    engines, use the :attr:`.Config.attributes` dictionary::

        with engine.begin() as connection:
            alembic_cfg.attributes['connection'] = connection
            command.upgrade(alembic_cfg, "head")

    :param file_: name of the .ini file to open.
    :param ini_section: name of the main Alembic section within the
     .ini file
    :param output_buffer: optional file-like input buffer which
     will be passed to the :class:`.MigrationContext` - used to redirect
     the output of "offline generation" when using Alembic programmatically.
    :param stdout: buffer where the "print" output of commands will be sent.
     Defaults to ``sys.stdout``.

     .. versionadded:: 0.4

    :param config_args: A dictionary of keys and values that will be used
     for substitution in the alembic config file.  The dictionary as given
     is **copied** to a new one, stored locally as the attribute
     ``.config_args``. When the :attr:`.Config.file_config` attribute is
     first invoked, the replacement variable ``here`` will be added to this
     dictionary before the dictionary is passed to ``SafeConfigParser()``
     to parse the .ini file.

     .. versionadded:: 0.7.0

    :param attributes: optional dictionary of arbitrary Python keys/values,
     which will be populated into the :attr:`.Config.attributes` dictionary.

     .. versionadded:: 0.7.5

     .. seealso::

        :ref:`connection_sharing`

    talembiccCsY||_||_||_||_||_t|�|_|rU|jj|�ndS(s*Construct a new :class:`.Config`

        N(	tconfig_file_nametconfig_ini_sectiont
output_buffertstdouttcmd_optstdicttconfig_argst
attributestupdate(tselftfile_tini_sectionR
RRRR((s?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pyt__init__Us					cCsiS(sA Python dictionary for storage of additional state.


        This is a utility dictionary which can include not just strings but
        engines, connections, schema objects, or anything else.
        Use this to pass objects into an env.py script, such as passing
        a :class:`sqlalchemy.engine.base.Connection` when calling
        commands from :mod:`alembic.command` programmatically.

        .. versionadded:: 0.7.5

        .. seealso::

            :ref:`connection_sharing`

            :paramref:`.Config.attributes`

        ((R((s?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pyR}scGs'tj|jtj|�|d�dS(s!Render a message to standard out.s
N(Rtwrite_outstreamRRt	text_type(Rttexttarg((s?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pytprint_stdout�scCs�|jr-tjjtjj|j��}nd}||jd<t|j�}|jrn|j|jg�n|j|j	�|S(sReturn the underlying ``ConfigParser`` object.

        Direct access to the .ini file is available here,
        though the :meth:`.Config.get_section` and
        :meth:`.Config.get_main_option`
        methods provide a possibly simpler interface.

        tthere(
RtostpathtabspathtdirnameRRtreadtadd_sectionR	(RRtfile_config((s?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pyR"�s	$
	cCstjjtd�S(s�Return the directory where Alembic setup templates are found.

        This method is used by the alembic ``init`` and ``list_templates``
        commands.

        t	templates(RRtjoinR(R((s?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pytget_template_directory�scCst|jj|��S(sfReturn all the configuration options from a given .ini file section
        as a dictionary.

        (R
R"titems(Rtname((s?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pytget_section�scCs|jj|j||�dS(szSet an option programmatically within the 'main' section.

        This overrides whatever was in the .ini file.

        N(R"tsetR	(RR'tvalue((s?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pytset_main_option�scCs|jj|j|�dS(N(R"t
remove_optionR	(RR'((s?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pytremove_main_option�scCs?|jj|�s%|jj|�n|jj|||�dS(s�Set an option programmatically within the given section.

        The section is created if it doesn't exist already.
        The value here will override whatever was in the .ini
        file.

        N(R"thas_sectionR!R)(RtsectionR'R*((s?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pytset_section_option�scCsa|jj|�s1tjd|j|f��n|jj||�rY|jj||�S|SdS(sCReturn an option from the given section of the .ini file.

        s6No config file %r found, or file has no '[%s]' sectionN(R"R.RtCommandErrorRt
has_optiontget(RR/R'tdefault((s?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pytget_section_option�s	cCs|j|j||�S(s�Return an option from the 'main' section of the .ini file.

        This defaults to being a key from the ``[alembic]``
        section, unless the ``-n/--name`` flag were used to
        indicate a different section.

        (R5R	(RR'R4((s?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pytget_main_option�sN(t__name__t
__module__t__doc__tNonetsysRRt
immutabledictRRRR	tmemoized_propertyRRR"R%R(R+R-R0R5R6(((s?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pyR
s"F		
								
tCommandLinecBs2eZdd�Zd�Zd�Zdd�ZRS(cCs|j|�dS(N(t_generate_args(Rtprog((s?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pyR�sc
	s��fd�}td|�}|jdddtdddd	�|jd
ddtdddd
�|jddddd�|jddddd�|j�}x
gtt�D]}tt|�^q�D]�}tj|�r�|j	ddkr�|j
dkr�tj|�}|drQ|ddt|d�!}|dt|d�}	n|dd}g}	|j
|j	d|j��|�||	��jd|||	f�q�q�W||_dS(Nc
s�iddtdddtdd�fd6d	d
tdtdd�fd6d
tdddd�fd6dtdtdd�fd6dtdtdd�fd6dtdddd�fd6dtdddd�fd6dtdtdd �fd!6d"tdtdd#�fd$6d%tdtdd&�fd'6d(d)tdddd*�fd+6d,tdddd-�fd.6d/tdddd0�fd16d2tdddd3�fd46d5d6tdd7dd8�fd96}id:d;6d<d=6d>d?6}xO|D]G}||kr�||}|d@dA!|dA}}|j||�q�q�Wx[|D]S}|d?krg�j|dBdCd|j|��q0�j|d|j|��q0WdS(DNs-ts
--templateR4tgenericttypethelps"Setup template for use with 'init'ttemplates-ms	--messages%Message string to use with 'revision'tmessages--sqltactiont
store_truesADon't emit SQL to database - dump to standard output/file insteadtsqls--tags<Arbitrary 'tag' name - can be used by custom env.py scripts.ttags--headsCSpecify head revision or <branchname>@head to base new revision on.theads--splices6Allow a non-head revision as the 'head' to splice ontotsplices--depends-ontappendsNSpecify one or more revision identifiers which this revision should depend on.t
depends_ons--rev-ids9Specify a hardcoded revision id instead of generating onetrev_ids--version-paths2Specify specific path from config for version filetversion_paths--branch-labels3Specify a branch label to apply to the new revisiontbranch_labels-vs	--verbosesUse more verbose outputtverboses--resolve-dependenciess+Treat dependency versions as down revisionstresolve_dependenciess--autogeneratesgPopulate revision script with candidate migration operations, based on comparison of database to model.tautogenerates--head-onlys0Deprecated.  Use --verbose for additional outputt	head_onlys-rs--rev-rangetstores1Specify a revision range; format is [start]:[end]t	rev_rangeslocation of scripts directoryt	directorysrevision identifiertrevisions/one or more revisions, or 'heads' for all headst	revisionsii����tnargst+(R
tstrtadd_argumentR3(tparsert
positionaltkwargstkwargs_optstpositional_helpRtargstkw(t	subparser(s?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pytadd_options�s�

















R@s-cs--configRBR4salembic.iniRCsAlternate config files-ns--nameRs6Name of section in .ini file to use for Alembic configs-xRFRLslAdditional arguments consumed by custom env.py scripts, e.g. -x setting1=somesetting -x setting2=somesettings
--raiseerrRGs!Raise a full stack trace on errorit_salembic.commandiitcmd(RR]R\tadd_subparserstdirRtgetattrtinspectt
isfunctionR7R8t
getargspectlent
add_parserR9tset_defaultsR^(
RR@RfR^t
subparserstntfntspecR_tkwarg((Res?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pyR?�s>�/
	 cs��j\}}}yF||g|D]}t�|�^q"t�fd�|D���Wn8tjk
r�}�jr|�q�tjt|��nXdS(Nc3s$|]}|t�|�fVqdS(N(Rk(t.0tk(toptions(s?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pys	<genexpr>�s(RhRkR
RR1traiseerrterrR\(RtconfigRyRtR_RvRxte((Rys?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pytrun_cmd�s!	cCsi|jj|�}t|d�s4|jjd�n1td|jd|jd|�}|j||�dS(NRhstoo few argumentsRRR(R^t
parse_argsthasattrterrorRR|R'R~(RtargvRytcfg((s?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pytmain�sN(R7R8R:RR?R~R�(((s?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pyR>�s	�	cKstd|�jd|�dS(s(The console runner function for Alembic.R@R�N(R>R�(R�R@R`((s?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pyR��st__main__(targparseRtutil.compatRRlRR;RRRRRtobjectRR>R:R�R7(((s?/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pyt<module>s��

Zerion Mini Shell 1.0