Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/alembic/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/alembic/__pycache__/config.cpython-311.pyc

�

�܋f�U��j�ddlmZddlmZddlmZddlmZddlZddlZddl	Z	ddl
mZddl
mZddl
m
Z
dd	l
mZdd
l
mZddl
mZddl
mZdd
l
mZddlmZddlmZddlmZddlmZddlmZGd�d��ZGd�ded���ZGd�d��Zdd�Zedkre��dSdS)�)�annotations)�ArgumentParser)�	Namespace)�ConfigParserN)�Any)�cast)�Dict)�Mapping)�Optional)�overload)�TextIO)�Union)�	TypedDict�)�__version__)�command)�util)�compatc��eZdZUdZdddejdej��dfd4d�ZdZ	d
e
d<	dZde
d<	dZde
d<	ej
d���Zd5d�Zej
d���Zd6d�Ze	d7d8d ���Zed9d"���Zed:d%���Z	d;d<d'�Zd=d)�Zd>d*�Zd?d,�Z	d;d@d.�ZedAd/���Ze	d;dBd0���Zd;d1�Zej
dCd3���ZdS)D�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 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("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�file_�"Union[str, os.PathLike[str], None]�ini_section�str�
output_buffer�Optional[TextIO]�stdoutr
�cmd_opts�Optional[Namespace]�config_args�Mapping[str, Any]�
attributes�Optional[dict]�return�Nonec��||_||_||_||_||_t|��|_|r|j�|��dSdS)z Construct a new :class:`.Config`N)	�config_file_name�config_ini_sectionrrr�dictr!r#�update)�selfrrrrrr!r#s        �E/opt/cloudlinux/venv/lib64/python3.11/site-packages/alembic/config.py�__init__zConfig.__init__dsh��!&���"-���*������ ��
���,�,����	/��O�"�"�:�.�.�.�.�.�	/�	/�r(r)c��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/�textc��|rt|��|z}nt|��}tj|j|dfi|j��dS)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,r3�arg�outputs    r-�print_stdoutzConfig.print_stdout�sP�� �	���Y�Y��_�F�F���Y�Y�F���T�[�&�$�N�N�$�:M�N�N�N�N�Nr/c�R�|jrBtj�tj�|j����}nd}||jd<t
|j��}|jr|�|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�dirnamer!r�read�add_sectionr))r,r=�file_configs   r-rDzConfig.file_config�s���� �	��7�?�?�2�7�?�?�4�3H�#I�#I�J�J�D�D��D�#'���� �"�4�#3�4�4��� �	=����d�3�4�5�5�5�5��#�#�D�$;�<�<�<��r/c���ddl}tj�tj�|j����}tj�|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@rA�__file__�join)r,r�package_dirs   r-�get_template_directoryzConfig.get_template_directory�sG��	�����g�o�o�b�g�o�o�g�6F�&G�&G�H�H���w�|�|�K��5�5�5r/.�name�default�Optional[Dict[str, str]]c��dS�Nr1�r,rKrLs   r-�get_sectionzConfig.get_section��	��	�r/�Dict[str, str]c��dSrOr1rPs   r-rQzConfig.get_section�rRr/�Mapping[str, str]�(Union[Dict[str, str], Mapping[str, str]]c��dSrOr1rPs   r-rQzConfig.get_section�rRr/�Optional[Mapping[str, str]]c��|j�|��s|St|j�|����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.

        )rD�has_sectionr*�itemsrPs   r-rQzConfig.get_section�sA����+�+�D�1�1�	��N��D�$�*�*�4�0�0�1�1�1r/�valuec�>�|�|j||��dS)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,rKr\s   r-�set_main_optionzConfig.set_main_options%��	
���� 7��u�E�E�E�E�Er/c�F�|j�|j|��dSrO)rD�
remove_optionr))r,rKs  r-�remove_main_optionzConfig.remove_main_options$����&�&�t�'>��E�E�E�E�Er/�sectionc��|j�|��s|j�|��|j�|||��dS)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)rDrZrC�set)r,rcrKr\s    r-r^zConfig.set_section_optionsU��(��+�+�G�4�4�	2���(�(��1�1�1�����W�d�E�2�2�2�2�2r/�
Optional[str]c���|j�|��s tjd|j�d|�d����|j�||��r|j�||��S|S)z9Return an option from the given section of the .ini file.zNo config file z found, or file has no '[z
]' section)rDrZr�CommandErrorr(�
has_option�get)r,rcrKrLs    r-�get_section_optionzConfig.get_section_option-s�����+�+�G�4�4�	��#�#�$(�$9�$9�$9�7�7�7�D���
���&�&�w��5�5�	��#�'�'���6�6�6��Nr/c��dSrOr1rPs   r-�get_main_optionzConfig.get_main_option;s���r/c��dSrOr1rPs   r-rmzConfig.get_main_option?rRr/c�:�|�|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.

        )rkr)rPs   r-rmzConfig.get_main_optionEs���&�&�t�'>��g�N�N�Nr/�MessagingOptionsc�|�tttjdt	|jdd��i����S)zThe messaging options.�quietF)rrpr�
immutabledict�getattrrr2s r-r7zConfig.messaging_optsOs?�������'�$�-��%�@�@�A�
�
�
�
�	
r/)rrrrrrrr
rr r!r"r#r$r%r&)r3rr%r&)r%r).)rKrrLr&r%rM)rKrrLrSr%rS)rKrrLrUr%rVrO)rKrrLrXr%rX)rKrr\rr%r&)rKrr%r&)rcrrKrr\rr%r&)rcrrKrrLrfr%rf)rKrrLrr%r)rKrrLrfr%rf)r%rp)�__name__�
__module__�__qualname__�__doc__�sysrrrsr.r�__annotations__r(r)�memoized_propertyr#r:rDrJrrQr_rbr^rkrmr7r1r/r-rrs��������F�F�T59�$�*.���(,�);��);�)=�)=�%)�/�/�/�/�/�(%)�H�(�(�(�(�	�<@��?�?�?�?�2�"��"�"�"�"��
�������&O�O�O�O�.
�������,
6�
6�
6�
6��),������X�������X��
�����X��AE�
2�
2�
2�
2�
2�F�F�F�F�"F�F�F�F�3�3�3�3�2AE�����������X���26������X��
O�O�O�O�
��
�
�
���
�
�
r/rc��eZdZUded<dS)rp�boolrrN)rurvrwrzr1r/r-rprpZs��������K�K�K�K�Kr/rpF)�totalc�0�eZdZddd�Zdd�Zdd�Zdd
�ZdS)�CommandLineN�progrfr%r&c�0�|�|��dSrO)�_generate_args)r,r�s  r-r.zCommandLine.__init___s�����D�!�!�!�!�!r/c	�J���
���
fd�}t|���}|�dddtz���|�ddttj�d	d
��d���|�d
dtdd���|�ddd���|�ddd���|�dddd���|���}tj	ddii�d�tt��D��D�]y�tj����ra�j
ddk�rO�jd k�rCtj���}|d!�I|dd"t#|d!���}|dt#|d!��d�}n|dd"d�}g}��vr��fd#�|D��}�j}|rXg}	|�d$��D]?}
|
���sn(|	�|
������@ng}	|��j
d%�|	���&���
|��
||���
��||f�'����{||_dS)(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]-}||vr'||}|dDdE�|dE}}|j|i|���.|D]t}|dFks|�	vr>�	||dFkr,�
�dFdG|�dF���H���J�
�||�|���I���udS)JN�templatez-tz
--template�genericz"Setup template for use with 'init')rL�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_argumentrj)�fn�parser�
positional�kwargs�kwargs_opts�positional_helpr8�args�kw�positional_translations�	subparsers         ��r-�add_optionsz/CommandLine._generate_args.<locals>.add_optionscs<���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�M�M��eH�n'�,��+�J����)�oH�|�$��+�0����!�}H�N��!��&�2�����OH�`#��(��+�<����%�aH�p���+�*�����qH�@���+�<�����AH�K�T=�1�N���O�
�
5�
5���+�%�%�&�s�+�D�#�A�b�D�z�4��8�"�D�'�F�'��4��4�4�4��!�
O�
O���;�&�&��4�4�4�/��3�C�8�K�G�G��*�*�#�!�,�0�0��=�=�+������*�*�3�_�5H�5H��5M�5M�*�N�N�N�N�
O�
Or/�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�rLr�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�c�8�g|]}tt|����Sr1)rtr)�.0�ns  r-�
<listcomp>z.CommandLine._generate_args.<locals>.<listcomp>0s"��=�=�=�1�7�7�A�&�&�=�=�=r/r�_zalembic.command�rc�H��g|]}���||����Sr1)rj)r�rKr�r�s  ��r-r�z.CommandLine._generate_args.<locals>.<listcomp>@s>���"�"�"� �0��3�7�7��d�C�C�"�"�"r/r5� r�)�cmd)rr�rrr>�environrj�add_subparsersr�stamp�dir�inspect�
isfunctionrurvr�inspect_getfullargspec�lenrx�split�stripr��
add_parserrH�set_defaultsr�)r,r�r�r��
subparsers�specr��kwarg�help_�	help_text�liner�r�r�s           @@@r-r�zCommandLine._generate_argsbsY�����a	O�a	O�a	O�a	O�a	O�a	O�F �T�*�*�*������	�>�K�3O�	�	
�	
�	
�	�������J�N�N�#3�]�C�C�D�	�	
�	
�	
�	�������L�	�	
�	
�	
�	�����;�	�	
�	
�	
�	�����4�	�	
�	
�	
�
	������,�		�	
�	
�	
��*�*�,�,�
�#*�=�:�{�2K�"L��=�=��G���=�=�=�$	D�$	D�B��"�2�&�&�#
D��K��N�c�)�)��M�%6�6�6��4�R�8�8����7�&�!%�a���c�$�q�'�l�l�]�):�!;�J� ��G�S��a��\�\�M�O�O�4�E�E�!%�a������J��E��0�0�0�"�"�"�"�"�$.�"�"�"�J��
���#� "�I� %���D� 1� 1�;�;��#�z�z�|�|�;�!�E�%�,�,�T�Z�Z�\�\�:�:�:�:�� "�I�&�1�1��K�c�h�h�y�&9�&9�2���	���B�	�:�u�=�=�=��&�&�B�
�E�+B�&�C�C�C������r/�configr�optionsrc����j\}}}	||g�fd�|D���Ri�fd�|D����dS#tj$r7}�jr�tjt|��fi|j��Yd}~dSd}~wwxYw)Nc�2��g|]}t�|d����SrO�rt�r��kr�s  �r-r�z'CommandLine.run_cmd.<locals>.<listcomp>]s%���@�@�@��'�'�1�d�+�+�@�@�@r/c�4��i|]}|t�|d����SrOr�r�s  �r-�
<dictcomp>z'CommandLine.run_cmd.<locals>.<dictcomp>^s'���?�?�?�A�1�g�g�q�$�/�/�?�?�?r/)r�rrh�raiseerr�errrr7)r,r�r�r�r�r��es  `    r-�run_cmdzCommandLine.run_cmdWs���� '����J��
	:��B��
�@�@�@�@�Z�@�@�@�
�
�
�@�?�?�?��?�?�?�
�
�
�
�
��
� �	:�	:�	:���
:�����Q���9�9�6�#8�9�9�9�9�9�9�9�9�9�����		:���s�$4�A:�,A5�5A:c��|j�|��}t|d��s|j�d��dSt	|j|j|���}|�||��dS)Nr�ztoo few arguments)rrr)r��
parse_args�hasattr�errorrr�rKr�)r,�argvr��cfgs    r-�mainzCommandLine.mainfs����+�(�(��.�.���w��&�&�
	'�
�K���1�2�2�2�2�2���n�#�L� ����C�

�L�L��g�&�&�&�&�&r/rO)r�rfr%r&)r�rr�rr%r&)rurvrwr.r�r�r�r1r/r-r�r�^sn������"�"�"�"�"�s�s�s�s�j
:�
:�
:�
:�'�'�'�'�'�'r/r�c�N�t|����|���dS)z(The console runner function for Alembic.r�)r�N)r�r�)r�r�r�s   r-r�r�us,���T������T��*�*�*�*�*r/�__main__)NN)�
__future__r�argparserr�configparserrr�r>ry�typingrrr	r
rrr
r�typing_extensionsrr<rrrrrrpr�r�rur1r/r-�<module>r�s��"�"�"�"�"�"�#�#�#�#�#�#�������%�%�%�%�%�%�����	�	�	�	�
�
�
�
�������������������������������������������������'�'�'�'�'�'�������������������������}
�}
�}
�}
�}
�}
�}
�}
�@
�����y������T'�T'�T'�T'�T'�T'�T'�T'�n+�+�+�+��z����D�F�F�F�F�F��r/

Hacked By AnonymousFox1.0, Coded By AnonymousFox