403Webshell
Server IP : 192.158.238.246  /  Your IP : 13.59.14.52
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib/python3.7/site-packages/alembic/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/alembic/__pycache__/config.cpython-37.pyc
B

�M!V�=�@s�ddlmZddlmZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddl	mZGd	d
�d
e�Z
Gdd�de�Zdd
d�Zedkr�e�dS)�)�ArgumentParser�)�SafeConfigParserN)�command)�util)�package_dir)�compatc@s�eZdZdZdddejde��dfdd�ZdZ	dZ
dZejdd��Z
dd	�Zejd
d��Zdd
�Zdd�Zdd�Zdd�Zdd�Zddd�Zddd�ZdS)�Configak
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`

    N�alembiccCs<||_||_||_||_||_t|�|_|r8|j�|�dS)z*Construct a new :class:`.Config`

        N)	�config_file_name�config_ini_section�
output_buffer�stdout�cmd_opts�dict�config_args�
attributes�update)�self�file_�ini_sectionr
rrrr�r�?/opt/alt/python37/lib/python3.7/site-packages/alembic/config.py�__init__Us
zConfig.__init__cCsiS)aA 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)rrrrr}szConfig.attributescGst�|jt�|�|d�dS)z!Render a message to standard out.�
N)rZwrite_outstreamrrZ	text_type)r�text�argrrr�print_stdout�szConfig.print_stdoutcCs\|jrtj�tj�|j��}nd}||jd<t|j�}|jrL|�|jg�n|�|j	�|S)aReturn 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.

        ��here)
r�os�path�abspath�dirnamerr�read�add_sectionr)rr�file_configrrrr&�s

zConfig.file_configcCstj�td�S)z�Return the directory where Alembic setup templates are found.

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

        Z	templates)r r!�joinr)rrrr�get_template_directory�szConfig.get_template_directorycCst|j�|��S)zfReturn all the configuration options from a given .ini file section
        as a dictionary.

        )rr&�items)r�namerrr�get_section�szConfig.get_sectioncCs|j�|j||�dS)zzSet an option programmatically within the 'main' section.

        This overrides whatever was in the .ini file.

        N)r&�setr)rr*�valuerrr�set_main_option�szConfig.set_main_optioncCs|j�|j|�dS)N)r&�
remove_optionr)rr*rrr�remove_main_option�szConfig.remove_main_optioncCs,|j�|�s|j�|�|j�|||�dS)z�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&�has_sectionr%r,)r�sectionr*r-rrr�set_section_option�szConfig.set_section_optioncCsD|j�|�s t�d|j|f��|j�||�r<|j�||�S|SdS)zCReturn an option from the given section of the .ini file.

        z6No config file %r found, or file has no '[%s]' sectionN)r&r1r�CommandErrorr�
has_option�get)rr2r*�defaultrrr�get_section_option�szConfig.get_section_optioncCs|�|j||�S)z�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.

        )r8r)rr*r7rrr�get_main_option�szConfig.get_main_option)N)N)�__name__�
__module__�__qualname__�__doc__�sysrrZ
immutabledictrrrrZmemoized_propertyrrr&r(r+r.r0r3r8r9rrrrr	
s"F
		

r	c@s0eZdZd
dd�Zdd�Zdd�Zddd	�ZdS)�CommandLineNcCs|�|�dS)N)�_generate_args)r�progrrrr�szCommandLine.__init__c	s:�fdd�}t|d�}|jddtddd�|jd	d
tddd�|jd
ddd�|jdddd�|��}x�dd�tt�D�D]�}t�|�rz|jddkrz|j	dkrzt�
|�}|dr�|ddt|d��}|dt|d�d�}n|ddd�}g}|j|j|j
d��|�||��j|||fd�qzW||_dS)Ncsxddtdtdd�fddttdd	�fd
tddd
�fdttdd	�fdttdd	�fdtddd
�fdtddd
�fdttdd	�fdttdd	�fdttdd	�fddtddd
�fd tdd!d
�fd"tdd#d
�fd$tdd%d
�fd&d'td(d)d
�fd*�}d+d,d-d.�}x>|D]6}||kr�||}|d/d0�|d0}}|j||�q�WxD|D]<}|d1k�rZ�j|d2|�|�d3�n�j||�|�d4��q4WdS)5Nz-tz
--templateZgenericz"Setup template for use with 'init')r7�type�helpz-mz	--messagez%Message string to use with 'revision')rBrCz--sql�
store_truezADon't emit SQL to database - dump to standard output/file instead)�actionrCz--tagz<Arbitrary 'tag' name - can be used by custom env.py scripts.z--headzCSpecify head revision or <branchname>@head to base new revision on.z--splicez6Allow a non-head revision as the 'head' to splice ontoz--depends-on�appendzNSpecify one or more revision identifiers which this revision should depend on.z--rev-idz9Specify a hardcoded revision id instead of generating onez--version-pathz2Specify specific path from config for version filez--branch-labelz3Specify a branch label to apply to the new revisionz-vz	--verbosezUse more verbose outputz--resolve-dependenciesz+Treat dependency versions as down revisionsz--autogeneratezgPopulate revision script with candidate migration operations, based on comparison of database to model.z--head-onlyz0Deprecated.  Use --verbose for additional outputz-rz--rev-range�storez1Specify a revision range; format is [start]:[end])�template�messageZsql�tag�headZspliceZ
depends_onZrev_idZversion_pathZbranch_label�verboseZresolve_dependenciesZautogenerateZ	head_onlyZ	rev_rangezlocation of scripts directoryzrevision identifierz/one or more revisions, or 'heads' for all heads)�	directory�revision�	revisionsr���rO�+)�nargsrC)rC)r�str�add_argumentr6)�parser�
positional�kwargsZkwargs_optsZpositional_helpr�args�kw)�	subparserrr�add_options�s�


z/CommandLine._generate_args.<locals>.add_options)rAz-cz--configzalembic.inizAlternate config file)rBr7rCz-nz--namer
z6Name of section in .ini file to use for Alembic configz-xrFzlAdditional arguments consumed by custom env.py scripts, e.g. -x setting1=somesetting -x setting2=somesetting)rErCz
--raiseerrrDz!Raise a full stack trace on errorcSsg|]}tt|��qSr)�getattrr)�.0�nrrr�
<listcomp>�sz.CommandLine._generate_args.<locals>.<listcomp>r�_zalembic.command�r)rC)�cmd)rrTrS�add_subparsers�dirr�inspect�
isfunctionr:r;�
getargspec�len�
add_parserr=�set_defaultsrU)	rrAr[rUZ
subparsers�fn�specrV�kwargr)rZrr@�s@




zCommandLine._generate_argsc
s��j\}}}y4||f�fdd�|D��t�fdd�|D���Wn<tjk
r|}z�jr^�nt�t|��Wdd}~XYnXdS)Ncsg|]}t�|��qSr)r\)r]�k)�optionsrrr_�sz'CommandLine.run_cmd.<locals>.<listcomp>c3s|]}|t�|�fVqdS)N)r\)r]rn)rorr�	<genexpr>�sz&CommandLine.run_cmd.<locals>.<genexpr>)rbrrr4Zraiseerr�errrS)r�configrorkrVrm�er)ror�run_cmd�szCommandLine.run_cmdcCsF|j�|�}t|d�s$|j�d�nt|j|j|d�}|�||�dS)Nrbztoo few arguments)rrr)rU�
parse_args�hasattr�errorr	rrr*rt)r�argvroZcfgrrr�main�s
zCommandLine.main)N)N)r:r;r<rr@rtryrrrrr?�s

/r?cKst|d�j|d�dS)z(The console runner function for Alembic.)rA)rxN)r?ry)rxrArWrrrry�sry�__main__)NN)�argparserZutil.compatrrer r>rrrrr�objectr	r?ryr:rrrr�<module>sfN


Youez - 2016 - github.com/yon3zu
LinuXploit