File: //opt/alt/python37/lib/python3.7/site-packages/alembic/__pycache__/config.cpython-37.opt-1.pyc
B
    �M!V�=  �               @   s�   d dl mZ ddlmZ d dlZd dlZd dlZddlmZ ddlm	Z	 ddlm
Z
 ddl	mZ G d	d
� d
e�Z
G dd� de�Zdd
d�Zedkr�e�  dS )�    )�ArgumentParser�   )�SafeConfigParserN)�command)�util)�package_dir)�compatc               @   s�   e Zd ZdZdddejde�� dfdd�ZdZ	dZ
dZejdd� �Z
dd	� Zejd
d� �Zdd
� 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�alembicc             C   s<