PK APOCALYPSE V1

APOCALYPSE V1

Current Path : /opt/hc_python/lib/python3.12/site-packages/alembic/__pycache__/
Upload File :
Current File : //opt/hc_python/lib/python3.12/site-packages/alembic/__pycache__/config.cpython-312.pyc

�

���g�V��l�ddlmZddlmZddlmZddlmZddlZddlZddl	Z	ddl
mZddl
mZddl
m
Z
dd	l
mZdd
l
mZddl
mZddl
mZdd
l
mZddl
mZddlmZddlmZddlmZddlmZddlmZGd�d�ZGd�ded��ZGd�d�Z		d							d d�Zedk(re�yy)!�)�annotations)�ArgumentParser)�	Namespace)�ConfigParserN)�Any)�cast)�Dict)�Mapping)�Optional)�overload)�Sequence)�TextIO)�Union)�	TypedDict�)�__version__)�command)�util)�compatc��eZdZUdZdddej
dej�df															dd�ZdZ	de
d<	dZde
d	<	dZde
d
<	ejdd��Zdd�Zejdd
��Zdd�Ze	d 					d!d��Ze						d"d��Ze						d#d��Z	d$					d%d�Zd&d�Zd'd�Zd(d�Z	d$							d)d�Zed*d��Ze	d$					d+d��Z	d$					d+d�Zejd,d��Zy)-�Configa`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 programmatically, 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("sqlalchemy.url", "postgresql://foo/bar")
        alembic_cfg.set_section_option("mysection", "foo", "bar")

    .. warning::

       When using programmatic configuration, make sure the
       ``env.py`` file in use is compatible with the target configuration;
       including that the call to Python ``logging.fileConfig()`` is
       omitted if the programmatic configuration doesn't actually include
       logging directives.

    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``.

    :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 ``ConfigParser()``
     to parse the .ini file.

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

     .. seealso::

        :ref:`connection_sharing`

    N�alembic�"Union[str, os.PathLike[str], None]�str�cmd_opts�Optional[Namespace]c��||_||_||_||_||_t|�|_|r|jj|�yy)z Construct a new :class:`.Config`N)	�config_file_name�config_ini_section�
output_buffer�stdoutr�dict�config_args�
attributes�update)�self�file_�ini_sectionr r!rr#r$s        �=/opt/hc_python/lib/python3.12/site-packages/alembic/config.py�__init__zConfig.__init__dsQ��!&���"-���*������ ��
���,�����O�O�"�"�:�.��rrc��iS)a�A 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.

        .. seealso::

            :ref:`connection_sharing`

            :paramref:`.Config.attributes`

        ��r&s r)r$zConfig.attributes�s	��$�	r+c��|rt|�|z}nt|�}tj|j|dfi|j��y)a�Render a message to standard out.

        When :meth:`.Config.print_stdout` is called with additional args
        those arguments will formatted against the provided text,
        otherwise we simply output the provided text verbatim.

        This is a no-op when the``quiet`` messaging option is enabled.

        e.g.::

            >>> config.print_stdout('Some text %s', 'arg')
            Some Text arg

        �
N)rr�write_outstreamr!�messaging_opts)r&�text�arg�outputs    r)�print_stdoutzConfig.print_stdout�s>�� ���Y��_�F���Y�F����T�[�[�&�$�N�$�:M�:M�Nr+c��|jrGtjjtjj	|j��}nd}||j
d<t
|j
�}|jr#tj||jg�|S|j|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�dirnamer#rr�read_config_parser�add_sectionr)r&r9�file_configs   r)r@zConfig.file_config�s���� � ��7�7�?�?�2�7�7�?�?�4�3H�3H�#I�J�D��D�#'����� �"�4�#3�#3�4��� � ��%�%�k�D�4I�4I�3J�K���
�#�#�D�$;�$;�<��r+c���ddl}tjjtjj	|j
��}tjj
|d�S)z�Return the directory where Alembic setup templates are found.

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

        rN�	templates)rr:r;r<r=�__file__�join)r&r�package_dirs   r)�get_template_directoryzConfig.get_template_directory�sA��	��g�g�o�o�b�g�g�o�o�g�6F�6F�&G�H���w�w�|�|�K��5�5r+c��y�Nr-�r&�name�defaults   r)�get_sectionzConfig.get_section�s��$'r+c��yrHr-rIs   r)rLzConfig.get_section�s��r+c��yrHr-rIs   r)rLzConfig.get_section�s��47r+c��|jj|�s|St|jj|��S)z�Return all the configuration options from a given .ini file section
        as a dictionary.

        If the given section does not exist, the value of ``default``
        is returned, which is expected to be a dictionary or other mapping.

        )r@�has_sectionr"�itemsrIs   r)rLzConfig.get_section�s9�����+�+�D�1��N��D�$�$�*�*�4�0�1�1r+c�>�|j|j||�y)a:Set an option programmatically within the 'main' section.

        This overrides whatever was in the .ini file.

        :param name: name of the value

        :param value: the value.  Note that this value is passed to
         ``ConfigParser.set``, which supports variable interpolation using
         pyformat (e.g. ``%(some_value)s``).   A raw percent sign not part of
         an interpolation symbol must therefore be escaped, e.g. ``%%``.
         The given value may refer to another value already in the file
         using the interpolation format.

        N)�set_section_optionr)r&rJ�values   r)�set_main_optionzConfig.set_main_option�s��	
���� 7� 7��u�Er+c�P�|jj|j|�yrH)r@�
remove_optionr)r&rJs  r)�remove_main_optionzConfig.remove_main_options�����&�&�t�'>�'>��Er+c��|jj|�s|jj|�|jj|||�y)a�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.

        :param section: name of the section

        :param name: name of the value

        :param value: the value.  Note that this value is passed to
         ``ConfigParser.set``, which supports variable interpolation using
         pyformat (e.g. ``%(some_value)s``).   A raw percent sign not part of
         an interpolation symbol must therefore be escaped, e.g. ``%%``.
         The given value may refer to another value already in the file
         using the interpolation format.

        N)r@rPr?�set)r&�sectionrJrTs    r)rSzConfig.set_section_optionsD��(���+�+�G�4����(�(��1������W�d�E�2r+c��|jj|�s&tjd|j�d|�d���|jj||�r|jj
||�S|S)z9Return an option from the given section of the .ini file.zNo config file z found, or file has no '[z
]' section)r@rPr�CommandErrorr�
has_option�get)r&r[rJrKs    r)�get_section_optionzConfig.get_section_option*sr�����+�+�G�4��#�#�$(�$9�$9�7�D��
����&�&�w��5��#�#�'�'���6�6��Nr+c��yrHr-rIs   r)�get_main_optionzConfig.get_main_option8s��?Br+c��yrHr-rIs   r)rbzConfig.get_main_option;s��r+c�<�|j|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.

        )r`rrIs   r)rbzConfig.get_main_option@s���&�&�t�'>�'>��g�N�Nr+c�v�tttjdt	|j
dd�i��S)zThe messaging options.�quietF)r�MessagingOptionsr�
immutabledict�getattrrr.s r)r2zConfig.messaging_optsLs7��������'�$�-�-��%�@�A�
�
�	
r+)r'rr(rr zOptional[TextIO]r!rrrr#zMapping[str, Any]r$zOptional[Dict[str, Any]]�return�None)rjzDict[str, Any])r3rr4rrjrk)rjr)rjr).)rJrrKrkrjzOptional[Dict[str, str]])rJrrK�Dict[str, str]rjrl)rJrrKzMapping[str, str]rjz(Union[Dict[str, str], Mapping[str, str]]rH)rJrrK�Optional[Mapping[str, str]]rjrm)rJrrTrrjrk)rJrrjrk)r[rrJrrTrrjrk)r[rrJrrK�
Optional[str]rjrn)rJrrKrrjr)rJrrKrnrjrn)rjrg)�__name__�
__module__�__qualname__�__doc__�sysr!rrhr*r�__annotations__rr�memoized_propertyr$r6r@rFrrLrUrXrSr`rbr2r-r+r)rrsZ��F�T59�$�*.����(,�);��);�);�)=�/3�/�1�/��/�(�	/�
�/�&�
/�'�/�-�/�
�/�(%)�H�!�(�	�<@��8�?�2�"���"��
������&O�.
������,
6��),�'��'�"&�'�	!�'��'�����"0��	�����7��7�"3�7�	1�7��7�
AE�
2��
2�"=�
2�	$�
2�F�"F�3�2AE����"%��0=��	���B��B�
�26����"/��	����
37�
O��
O�"/�
O�	�
O�
���
��
r+rc��eZdZUded<y)rg�boolrfN)rorprqrtr-r+r)rgrgWs���Kr+rgF)�totalc�0�eZdZddd�Zdd�Zdd�Zdd	d�Zy)
�CommandLineNc�&�|j|�yrH)�_generate_args)r&�progs  r)r*zCommandLine.__init__\s�����D�!r+c	����										d&��fd�}t|��}|jdddtz��|jddttj
j
d	d
�d��|jd
dtdd��|jddd��|jddd��|jdddd��|j�}tjddii�tt�D�cgc]}tt|���c}D�]W}tj|�s�|jddk7s�-|jdk(s�=t!j"|�}|d �+|dd!t%|d �}|dt%|d �d}	n
|dd!d}g}	|�vr"|D�
cgc]}
�|j
|
|
���}}
|j&}|rJg}|j)d"�D]3}
|
j+�sn$|j-|
j+���5ng}|j/|jd#j1|��$��||�||	��j3|||	f�%���Z||_ycc}wcc}
w)'Nc	���idddtdtd��f�ddd	ttd
��f�dd
tdd��f�ddttd��f�ddttd��f�ddtdd��f�ddtdd��f�ddttd ��f�d!d"ttd#��f�d$d%ttd&��f�d'd(d)tdd*��f�d+d,tdd-��f�d.d/tdd0��f�d1d2d3td4d5��f�d6d7d8tdd9��f�d:d;tdd<��f�d=d>tdd?��f�}d@dAdBdC�}|D](}||vs�||}|dDdE|dE}}|j|i|���*|D]\}|dFk(s|�	vr/�	||dFk(r$�
jdFdG|jdF��H��;�
j||j|��I��^y)JN�templatez-tz
--template�genericz"Setup template for use with 'init')rK�type�help�messagez-mz	--messagez%Message string to use with 'revision')r�r��sqlz--sql�
store_truez\Don't emit SQL to database - dump to standard output/file instead. See docs on offline mode.��actionr��tagz--tagz<Arbitrary 'tag' name - can be used by custom env.py scripts.�headz--headzCSpecify head revision or <branchname>@head to base new revision on.�splicez--splicez6Allow a non-head revision as the 'head' to splice onto�
depends_onz--depends-on�appendzNSpecify one or more revision identifiers which this revision should depend on.�rev_idz--rev-idz9Specify a hardcoded revision id instead of generating one�version_pathz--version-pathz2Specify specific path from config for version file�branch_labelz--branch-labelz3Specify a branch label to apply to the new revision�verbosez-vz	--verbosezUse more verbose output�resolve_dependenciesz--resolve-dependenciesz+Treat dependency versions as down revisions�autogeneratez--autogeneratezgPopulate revision script with candidate migration operations, based on comparison of database to model.�	rev_rangez-rz--rev-range�storez1Specify a revision range; format is [start]:[end]�indicate_currentz-iz--indicate-currentzIndicate the current revision�purgez--purgez7Unconditionally erase the version table before stamping�packagez	--packagezFWrite empty __init__.py files to the environment and version locationszlocation of scripts directoryzrevision identifierz/one or more revisions, or 'heads' for all heads)�	directory�revision�	revisionsr���r��+)�nargsr��r�)r"r�add_argumentr_)�fn�parser�
positional�kwargs�kwargs_opts�positional_helpr4�args�kw�positional_translations�	subparsers         ��r)�add_optionsz/CommandLine._generate_args.<locals>.add_options`sK���H��� �� )� �A���H����� �'N���H�"���+�(���#H�4��� �1���5H�D��� �3���EH�T���+�0���UH�d�"��'�@���eH�t��� �)���uH�D�$�� �'��!�EH�T�$�� �'��!�UH�d�����3L�M��eH�n'�,��+�J��)�oH�|�$��+�0��!�}H�N��!��&�2���OH�`#��(��+�<��%�aH�p���+�*���qH�@���+�<���AH�K�T=�1�N��O�
���+�%�&�s�+�D�#�A�b�z�4��8�"�D�'�F�'�'��4��4�	�"���;�&��4�4�/��3�C�8�K�G��*�*�#�!�,�0�0��=�+���*�*�3�_�5H�5H��5M�*�N�"r+�r}z	--version�versionz%%(prog)s %s)r�r�z-cz--config�ALEMBIC_CONFIGzalembic.inizaAlternate config file; defaults to value of ALEMBIC_CONFIG environment variable, or "alembic.ini")r�rKr�z-nz--namerz6Name of section in .ini file to use for Alembic configz-xr�zlAdditional arguments consumed by custom env.py scripts, e.g. -x setting1=somesetting -x setting2=somesettingr�z
--raiseerrr�z!Raise a full stack trace on errorz-qz--quietzDo not log to std output.r�r�r�_zalembic.command�rr0� r�)�cmd)
r�rr�rr�rr�rrjrk)rr�rrr:�environr_�add_subparsersr�stamp�dirri�inspect�
isfunctionrorpr�inspect_getfullargspec�lenrr�split�stripr��
add_parserrD�set_defaultsr�)r&r}r�r��
subparsers�nr��specr��kwargrJ�help_�	help_text�liner�r�s              @@r)r|zCommandLine._generate_args_s����c	O��c	O� �c	O�.1�c	O�;>�c	O�
�c	O�J �T�*������	�>�K�3O�	�	
�	�������J�J�N�N�#3�]�C�D�	�	
�	�������L�	�	
�	�����;�	�	
�	�����4�	�	
�
	������,�		�	
��*�*�,�
�
�M�M�J��4�3
��14�G��=��1�7�7�A�&��=�B��"�"�2�&��K�K��N�c�)��M�M�%6�6��4�4�R�8����7�&�!%�a���c�$�q�'�l�]�!;�J� ��G�S��a��\�M�O�4�E�!%�a�����J��E��0�0�%/�"�$.�D�0��3�7�7��d�C�$.��"��
�
��� "�I� %���D� 1��#�z�z�|�!�%�,�,�T�Z�Z�\�:�	!2�!#�I�&�1�1��K�K�c�h�h�y�&9�2��	��B�	�:�u�=��&�&�B�
�E�+B�&�C�G>�H����I>��"s�?I<�-Jc
�d�|j\}}}	||g|D�cgc]}t||d���c}��i|D�cic]}|t||d���c}��ycc}wcc}w#tj$r@}|jr�tj
t
|�fi|j��Yd}~yd}~wwxYwrH)r�rirr]�raiseerr�errrr2)r&�config�optionsr�r�r��k�es        r)�run_cmdzCommandLine.run_cmdWs��� '�����J��
	:���
�5?�@�Z��'�'�1�d�+�Z�@�
�:?�?��A�1�g�g�q�$�/�/��?�
��@��?��� � �	:���������Q��9�6�#8�#8�9��		:�s2�A�A
�	A�A�A�
A�B/�/6B*�*B/c���|jj|�}t|d�s|jjd�yt	|j
|j|��}|j||�y)Nr�ztoo few arguments)r'r(r)r��
parse_args�hasattr�errorrr�rJr�)r&�argvr��cfgs    r)�mainzCommandLine.mainfs`���+�+�(�(��.���w��&�
�K�K���1�2���n�n�#�L�L� ��C�

�L�L��g�&r+rH)r}rnrjrk)r�rr�rrjrk)r��Optional[Sequence[str]]rjrk)rorprqr*r|r�r�r-r+r)rzrz[s��"�v�p
:�'r+rzc�<�t|��j|��y)z(The console runner function for Alembic.r�)r�N)rzr�)r�r}r�s   r)r�r�us���T����T��*r+�__main__)NN)r�r�r}rnr�rrjrk) �
__future__r�argparserr�configparserrr�r:rs�typingrrr	r
rrr
rr�typing_extensionsrr8rrrrrrgrzr�ror-r+r)�<module>r�s���"�#��%��	�
����������'�����y
�y
�x	�y���W'�W'�v%)��+�
!�+�
�+��+�
�	+��z���F�r+

if you don't want to be vaporized in a nuclear explosion, i simply have to become nuclear myself… i am atomic