Hacked By AnonymousFox

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

�

�܋f�����ddlmZddlmZddlZddlZddlZddlZddlZddl	m
Z
ddlmZddlm
Z
ddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZerddlmZddlm Z ddl!m"Z"ddl!m#Z#ddl$m%Z%	ddl&m'Z'n
#e($rdZ'YnwxYwee)ee)fZ*ej+d��Z,ej+d��Z-ej+d��Z.ej+d ��Z/ej+d!��Z0d"Z1ej+d#��Z2ej+d$��Z3Gd%�d&��Z4Gd'�d(ej%��Z5dS))�)�annotations)�contextmanagerN)�
ModuleType)�Any)�cast)�Iterator)�List)�Mapping)�Optional)�Sequence)�Set)�Tuple)�
TYPE_CHECKING)�Union���revision)�write_hooks�)�util)�	migration)�not_none)�Config)�MessagingOptions)�RevisionStep)�	StampStep)�Revision)�tzz (?!\.\#|__init__)(.*\.py)(c|o)?$z(?!\.\#|__init__)(.*\.py)$z([a-f0-9]+)\.py$z(upgrade|downgrade)_([a-z0-9]+)z\w+z%(rev)s_%(slug)sz
, *|(?: +)z
, *|(?: +)|\:c��eZdZdZedddddddedej��f	dad�Ze	dbd���Z
ejd���Zdcd�Z
eddd ���Ze					dedfd'���Z	dgdhd+�Zdid/�Zdjd2�Zdkd4�Zdld6�Zdmd<�Zdnd=�Zdod?�Zdnd@�ZdodA�ZdpdE�ZdqdF�ZdrdI�ZdsdJ�Ze	dK���Z dtdN�Z!dudO�Z"dvdQ�Z#dwdS�Z$						dxdyd]�Z%dzd`�Z&dS){�ScriptDirectoryaHProvides operations upon an Alembic script directory.

    This object is useful to get information as to current revisions,
    most notably being able to get at the "head" revision, for schemes
    that want to test if the current revision in the database is the most
    recent::

        from alembic.script import ScriptDirectory
        from alembic.config import Config
        config = Config()
        config.set_main_option("script_location", "myapp:migrations")
        script = ScriptDirectory.from_config(config)

        head_revision = script.get_current_head()



    �(NF�utf-8r�dir�str�
file_template�truncate_slug_length�
Optional[int]�version_locations�Optional[List[str]]�
sourceless�bool�output_encoding�timezone�
Optional[str]�hook_config�Optional[Mapping[str, str]]�recursive_version_locations�messaging_opts�return�Nonec�x�||_||_||_|pd|_||_||_t
j|j��|_	||_
||_|	|_|
|_
tj|tj��s4t#jdtj�|��z���dS)Nr!zVPath doesn't exist: %r.  Please use the 'init' command to create a new scripts folder.)r#r%r(r&r*r,r�RevisionMap�_load_revisions�revision_mapr-r/r1r2�os�access�F_OKr�CommandError�path�abspath)�selfr#r%r&r(r*r,r-r/r1r2s           �J/opt/cloudlinux/venv/lib64/python3.11/site-packages/alembic/script/base.py�__init__zScriptDirectory.__init__Js������*���!2���$8�$>�B��!�$���.���$�0��1E�F�F��� ��
�&���+F��(�,����y��b�g�&�&�	��#�"�$&�G�O�O�C�$8�$8�9���
�	�	�c�n�|j}t|��dkrtjd���|dS)Nrz"Multiple version_locations presentr)�_version_locations�lenrr<)r?�locs  r@�versionszScriptDirectory.versionsls4���%���s�8�8�a�<�<��#�$H�I�I�I��q�6�MrBc��|jrd�|jD��Stj�tj�|jd����fS)Nc�p�g|]3}tj�tj|������4S�)r9r=r>r�coerce_resource_to_filename)�.0�locations  r@�
<listcomp>z6ScriptDirectory._version_locations.<locals>.<listcomp>wsA����������� @�� J� J�K�K���rBrG)r(r9r=r>�joinr#�r?s r@rDz"ScriptDirectory._version_locationsts]���!�	J��� $� 6����
�
�G�O�O�B�G�L�L���:�$F�$F�G�G�I�IrB�Iterator[Script]c#�K�|jrd�|jD��}n|jg}t��}|D]�}t�||��D]�}tj�|��}||vrtj
d|z���=|�|��tj�|��}tj�
|��}t�|||��}|���|V�����dS)Nc�P�g|]#}tj�|���!|��$SrJ)r9r=�exists)rL�verss  r@rNz3ScriptDirectory._load_revisions.<locals>.<listcomp>�s<�������7�>�>�$�'�'�����rBzJFile %s loaded twice! ignoring. Please ensure version_locations is unique.)r(rDrG�set�Script�_list_py_dirr9r=�realpathr�warn�add�basename�dirname�_from_filename)	r?�paths�dupesrU�	file_path�	real_path�filename�dir_name�scripts	         r@r7zScriptDirectory._load_revisions~s0�����!�	$��� �3����E�E��]�O�E������	�	�D�#�0�0��t�<�<�
�
�	��G�,�,�Y�7�7�	���%�%��I�7�9B�C������	�	�)�$�$�$��7�+�+�I�6�6���7�?�?�9�5�5���.�.�t�X�x�H�H���>�������
�	�	rB�configrc
��|�d��}|�tjd���|�d��}|�t|��}nd}|�d��}|r�|�d��}ddtjdd	d
�}	||}|�t�|��}	nGd�|�|��D��}	n'#t$r}
td|z��|
�d}
~
wwxYwd}	|�d
��}|r6tt�|����tj
dd�<|�d��dk}ttj|��|�dt ��||�d��dk|�dd��|	|�d��|�di��||j��
�
S)z�Produce a new :class:`.ScriptDirectory` given a :class:`.Config`
        instance.

        The :class:`.Config` need only have the ``script_location`` key
        present.

        �script_locationNz0No 'script_location' key found in configuration.r&r(�version_path_separator� �:�;)N�spacer9rkrlc��g|]}|�|��SrJrJ)rL�xs  r@rNz/ScriptDirectory.from_config.<locals>.<listcomp>�s-��)�)�)��a�)��)�)�)rBzV'%s' is not a valid value for version_path_separator; expected 'space', 'os', ':', ';'�prepend_sys_pathrr1�truer%r*r,r"r-�post_write_hooks)	r%r&r*r,r(r-r/r1r2)�get_main_optionrr<�intr9�pathsep�_split_on_space_comma�split�KeyError�
ValueError�list�_split_on_space_comma_colon�sysr=r rK�_default_file_template�get_sectionr2)
�clsrfrh�tslr&�version_locations_strri�
split_on_path�
split_charr(�kerp�rvls
             r@�from_configzScriptDirectory.from_config�sp��!�0�0�1B�C�C���"��#�E���
��$�$�%;�<�<���?�#&�s�8�8� � �#'� � &� 6� 6�7J� K� K�� �"	%�%+�%;�%;�(�&�&�"�
���j�����M�
�,9�*�-�
��%�(=�(C�(C�-�)�)�%�%�)�)�#8�#>�#>�z�#J�#J�)�)�)�%�%���
�
�
� �7�9O�P����	�����
����"!%��!�1�1�2D�E�E���	��+�1�1�2B�C�C���C�H�R�a�R�L��$�$�%B�C�C�v�M����,�_�=�=� �0�0��!7���"6��-�-�l�;�;�v�E�"�2�2�3D�g�N�N�/��+�+�J�7�7��*�*�+=�r�B�B�(+�!�0�

�

�

�
	
s�C�
C;�#C6�6C;�ancestor�multiple_heads�start�end�
resolution�Iterator[None]c#�`K�	dV�dS#tj$r^}|�tt|j��}|�tt|j��}|sd}|||d�z}t
j|��|�d}~wtj$rD}|sd}||p|j	t
j
|j��d�z}t
j|��|�d}~wtj$r&}|�
d|j	z}t
j|��|�d}~wtj
$r%}	t
j|	jd��|	�d}	~	wwxYw)NzgRequested range %(start)s:%(end)s does not refer to ancestor/descendant revisions along the same branch�r�r�z�Multiple head revisions are present for given argument '%(head_arg)s'; please specify a specific target revision, '<branchname>@%(head_arg)s' to narrow to a specific head, or 'heads' for all heads)�head_arg�headsz(Can't locate revision identified by '%s'r)r�RangeNotAncestorErrorrr�lower�upperrr<�
MultipleHeads�argument�format_as_commar��ResolutionError�
RevisionError�args)
r?r�r�r�r�r��rna�mh�re�errs
          r@�_catch_revision_errorsz&ScriptDirectory._catch_revision_errors�s�����#	:��E�E�E�E�E���-�	7�	7�	7��}��S�#�)�,�,���{��3��	�*�*���
�J�� �E�#�">�">�>�H��#�H�-�-�3�6������%�
	<�
	<�
	<�!�
�J��,��.�2�;��-�b�h�7�7�/�/��N��#�N�3�3��;������'�	8�	8�	8��!�G��K��
��#�J�/�/�R�7������%�	:�	:�	:��#�C�H�Q�K�0�0�c�9�����	:���s9�
�D-�AA2�2D-�?C�D-�!C6�6D-� D(�(D-�baser��headc#��K�|�||���5|j�||dd���D]}tt|��V��	ddd��dS#1swxYwYdS)a-Iterate through all revisions.

        :param base: the base revision, or "base" to start from the
         empty revision.

        :param head: the head revision; defaults to "heads" to indicate
         all head revisions.  May also be "head" to indicate a single
         head revision.

        r�TF)�	inclusive�assert_relative_lengthN)r�r8�iterate_revisionsrrW)r?r�r��revs    r@�walk_revisionszScriptDirectory.walk_revisionss������
(�
(�t��
(�
>�
>�	(�	(��(�:�:��d�d�5�;���
(�
(���6�3�'�'�'�'�'�'�
(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(����	(�	(�	(�	(�	(�	(s�9A!�!A%�(A%�id_�
_RevIdType�Tuple[Optional[Script], ...]c���|���5ttttdf|j�|����cddd��S#1swxYwYdS)z�Return the :class:`.Script` instance with the given rev identifier,
        symbolic name, or sequence of identifiers.

        .N)r�rrrrWr8�
get_revisions�r?r�s  r@r�zScriptDirectory.get_revisions-s���
�
(�
(�
*�
*�	�	���h�v�&��+�,��!�/�/��4�4���	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�AA'�'A+�.A+�Tuple[str, ...]�Set[Optional[Script]]c���|���5tttt|j�|����cddd��S#1swxYwYdS�N)r�rr
rrWr8�_get_all_currentr�s  r@�get_all_currentzScriptDirectory.get_all_current8s���
�
(�
(�
*�
*�	�	���H�V�$�%�t�'8�'I�'I�#�'N�'N���	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�AA%�%A)�,A)�Optional[Script]c���|���5ttt|j�|����cddd��S#1swxYwYdS)z�Return the :class:`.Script` instance with the given rev id.

        .. seealso::

            :meth:`.ScriptDirectory.get_revisions`

        N)r�rrrWr8�get_revisionr�s  r@r�zScriptDirectory.get_revision>s����
(�
(�
*�
*�	O�	O����(�$�*;�*H�*H��*M�*M�N�N�	O�	O�	O�	O�	O�	O�	O�	O�	O�	O�	O�	O����	O�	O�	O�	O�	O�	Os�8A�A�!A�%Optional[Union[str, Tuple[str, ...]]]c��|���5|j�|��\}}ddd��n#1swxYwY|sdS|dkr|S|dS)z[Convert a symbolic revision, i.e. 'head' or 'base', into
        an actual revision number.Nr�r)r�r8�_resolve_revision_number)r?r�r��branch_names    r@�as_revision_numberz"ScriptDirectory.as_revision_numberJs����
(�
(�
*�
*�	O�	O�#�0�I�I�#�N�N��C��	O�	O�	O�	O�	O�	O�	O�	O�	O�	O�	O����	O�	O�	O�	O��	��4�
�G�^�^��J��q�6�Ms�?�A�Ar��!Union[str, Tuple[str, ...], None]r��kwrc�f�ttt|jj||fi|����S)a�Iterate through script revisions, starting at the given
        upper revision identifier and ending at the lower.

        The traversal uses strictly the `down_revision`
        marker inside each migration script, so
        it is a requirement that upper >= lower,
        else you'll get nothing back.

        The iterator yields :class:`.Script` objects.

        .. seealso::

            :meth:`.RevisionMap.iterate_revisions`

        )rrrWr8r�)r?r�r�r�s    r@r�z!ScriptDirectory.iterate_revisions[s;��*��V��/�D��/��u�C�C��C�C�
�
�	
rBc��|�d���5|j���cddd��S#1swxYwYdS)aGReturn the current head revision.

        If the script directory has multiple heads
        due to branching, an error is raised;
        :meth:`.ScriptDirectory.get_heads` should be
        preferred.

        :return: a string revision number.

        .. seealso::

            :meth:`.ScriptDirectory.get_heads`

        z}The script directory has multiple heads (due to branching).Please use get_heads(), or merge the branches using alembic merge.�r�N)r�r8�get_current_headrPs r@r�z ScriptDirectory.get_current_headus����
(�
(�!�)�
�
�	8�	8��$�5�5�7�7�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8����	8�	8�	8�	8�	8�	8s�=�A�A�	List[str]c�4�t|jj��S)aUReturn all "versioned head" revisions as strings.

        This is normally a list of length one,
        unless branches are present.  The
        :meth:`.ScriptDirectory.get_current_head()` method
        can be used normally when a script directory
        has only one head.

        :return: a tuple of string revision numbers.
        )rzr8r�rPs r@�	get_headszScriptDirectory.get_heads�s���D�%�+�,�,�,rBc��|���}t|��dkrtjd���|r|dSdS)a#Return the "base" revision as a string.

        This is the revision number of the script that
        has a ``down_revision`` of None.

        If the script directory has multiple bases, an error is raised;
        :meth:`.ScriptDirectory.get_bases` should be
        preferred.

        rz@The script directory has multiple bases. Please use get_bases().rN)�	get_basesrErr<)r?�basess  r@�get_basezScriptDirectory.get_base�sT����� � ���u�:�:��>�>��#�*���
��	���8�O��4rBc�4�t|jj��S)z�return all "base" revisions as strings.

        This is the revision number of all scripts that
        have a ``down_revision`` of None.

        )rzr8r�rPs r@r�zScriptDirectory.get_bases�s���D�%�+�,�,�,rB�destination�current_rev�List[RevisionStep]c������d|���5��||d���}�fd�tt|����D��cddd��S#1swxYwYdS)NzFDestination %(end)s is not a valid upgrade target from current head(s)�r�r�T)�
implicit_basec�Z��g|]'}tj��j|����(SrJ)r�
MigrationStep�upgrade_from_scriptr8�rLrer?s  �r@rNz1ScriptDirectory._upgrade_revs.<locals>.<listcomp>�sF��������'�;�;��%�v�����rB)r�r��reversedrz�r?r�r��revss`   r@�
_upgrade_revszScriptDirectory._upgrade_revs�s�����
(�
(�*��)�
�
�
	�
	�
�)�)��[��*���D�����'�t�D�z�z�2�2�	���
	�
	�
	�
	�
	�
	�
	�
	�
	�
	�
	�
	����
	�
	�
	�
	�
	�
	s�AA&�&A*�-A*c�����d|���5��||d���}�fd�|D��cddd��S#1swxYwYdS)NzHDestination %(end)s is not a valid downgrade target from current head(s)r�T)�select_for_downgradec�Z��g|]'}tj��j|����(SrJ)rr��downgrade_from_scriptr8r�s  �r@rNz3ScriptDirectory._downgrade_revs.<locals>.<listcomp>�sF��������'�=�=��%�v�����rB)r�r�r�s`   r@�_downgrade_revszScriptDirectory._downgrade_revs�s�����
(�
(�*��)�
�
�
	�
	�
�)�)��[�t�*���D�����#�	���
	�
	�
	�
	�
	�
	�
	�
	�
	�
	�
	�
	����
	�
	�
	�
	�
	�
	s�&A�A�Ar�List[StampStep]c
������d���5��|��}g}|sd}g}tj|��D]R}|rN|��j�ttt|��|d������Stj
|��}��|��pdg}|D�]}}|�"|��fd�|D�����'||vr�,t�j�|g����}	t�j�
|g����}
|	�|��r[|
�|��rJ�d�|D��}tj||jdd�j��}|�|����|
�|��rEd	�|D��}tj||jdd�j��}|�|����Ftjd
|jdd�j��}|�|����|cddd��S#1swxYwYdS)NzCMultiple heads are present; please specify a single target revisionr�r�T)�include_dependenciesc	�T��g|]$}tj|jddd�j����%S)NFT)rrrr8)rLr�r?s  �r@rNz/ScriptDirectory._stamp_revs.<locals>.<listcomp>sL���	�	�	�!%�&�/� $�
� $� %� $� $� 1���	�	�	rBc��g|]	}|j��
SrJr�rLr�s  r@rNz/ScriptDirectory._stamp_revs.<locals>.<listcomp>���!K�!K�!K�D�$�-�!K�!K�!KrBFc��g|]	}|j��
SrJrr�s  r@rNz/ScriptDirectory._stamp_revs.<locals>.<listcomp>(r�rBrJ)r�r�r�to_tuple�extendr8�filter_for_lineagerrrW�unique_listrV�_get_descendant_nodes�_get_ancestor_nodes�intersectionrrr�append)
r?rr��
heads_revs�steps�filtered_headsr��dests�dest�descendants�	ancestors�
todo_heads�steps
`            r@�_stamp_revszScriptDirectory._stamp_revs�s<����
(�
(�%�)�
�
�[	�[	�
�+�+�E�2�2�J��E��
"�!��+-�N��}�X�.�.�
�
����"�)�)��)�<�<� ��&�!1�:�>�>��15�=�������"�-�n�=�=�N��&�&�x�0�0�:�T�F�E��?
�?
���<��L�L�	�	�	�	�)7�	�	�	������^�+�+��"��%�;�;�T�F�C�C���� �� 1� E� E�t�f� M� M�N�N�	��+�+�N�;�;�"� )�5�5�n�E�E�E�E�E�!K�!K�N�!K�!K�!K�J�$�.�"��
����)���D��L�L��&�&�&���+�+�N�;�;��"L�!K�N�!K�!K�!K�J�$�.�"��
����)���D��L�L��&�&�&��%�.��D�M�4��t�7H���D��L�L��&�&�&���w[	�[	�[	�[	�[	�[	�[	�[	�[	�[	�[	�[	����[	�[	�[	�[	�[	�[	s�H3I�I�Ic�:�tj|jd��dS)z�Run the script environment.

        This basically runs the ``env.py`` script present
        in the migration environment.   It is called exclusively
        by the command functions in :mod:`alembic.command`.


        �env.pyN)r�load_python_filer#rPs r@�run_envzScriptDirectory.run_env=s��	
��d�h��1�1�1�1�1rBc��tj�tj�|jd����S)Nr�)r9r=r>rOr#rPs r@�env_py_locationzScriptDirectory.env_py_locationHs(���w���r�w�|�|�D�H�h�?�?�@�@�@rB�srcr�c���tjdtj�|����fi|j��5tj|||jfi|��ddd��dS#1swxYwYdS�NzGenerating )r�statusr9r=r>r2�template_to_filer,)r?r�r�r�s    r@�_generate_templatez"ScriptDirectory._generate_templateLs���
�[�1�"�'�/�/�$�/�/�1�1�
�
�59�5H�
�
�	I�	I�
�!�#�t�T�-A�H�H�R�H�H�H�	I�	I�	I�	I�	I�	I�	I�	I�	I�	I�	I�	I����	I�	I�	I�	I�	I�	Is�A�A#�&A#c���tjdtj�|����fi|j��5t
j||��ddd��dS#1swxYwYdSr�)rr�r9r=r>r2�shutil�copy)r?r�r�s   r@�
_copy_filezScriptDirectory._copy_fileRs���
�[�1�"�'�/�/�$�/�/�1�1�
�
�59�5H�
�
�	#�	#�
�K��T�"�"�"�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#�	#�	#s�A�A�"Ar=c��tj�|��}tj�|��sIt	jd|��fi|j��5tj|��ddd��dS#1swxYwYdSdS)NzCreating directory )r9r=r>rTrr�r2�makedirs)r?r=s  r@�_ensure_directoryz!ScriptDirectory._ensure_directoryXs����w���t�$�$���w�~�~�d�#�#�	"���,�d�,�,���04�0C���
"�
"���D�!�!�!�
"�
"�
"�
"�
"�
"�
"�
"�
"�
"�
"�
"����
"�
"�
"�
"�
"�
"�	"�	"s�A;�;A?�A?�datetime.datetimec��|j��t�tjd���tj|j��}|�+tj|j�����}|�tjd|jz���tj����tj	������
|��}ntj���}|S)Nz>The library 'python-dateutil' is required for timezone supportzCan't locate timezone: %s)�tzinfo)r-rrr<�gettzr��datetime�utcnow�replace�tzutc�
astimezone�now)r?r�create_dates   r@�_generate_create_datez%ScriptDirectory._generate_create_date`s����=�$��z��'�+����
�X�d�m�,�,�F��~���$�-�"5�"5�"7�"7�8�8���~��'�/�$�-�?�����!�(�(�*�*�����
�
��+�+���F�#�#�
�K�#�+�/�/�1�1�K��rB�revid�message�refresh�splice�Optional[bool]�
branch_labels�version_path�
depends_on�Optional[_RevIdType]c	���|�d}	t�|��n7#tj$r%}
t	j|
jd��|
�d}
~
wwxYw��d���5tttddf�j�|����}|D]
}|dksJ��	ddd��n#1swxYwYtt|����t|��krt	jd	�������}
|�xt�j��d
krY|D]A}|�=t#|t��sJ�t$j�|j��}n�Bt	jd���n�j}t$j�t$j�|����}�jD]'}t$j�|��|krn�(t	jd|z����jr��|����||||
��}|s*|D]'}|�#|jst	jd
|jz����(|rW����5d��fd�t	j|��D��D��}ddd��n#1swxYwYnd}�jt$j��jd��|ftA|��tj!tEd�|D������t	j#|��tj!|��|
tj$|�|ndd�|	���j%}|rtMj'||��	t�(�|��}n7#tj$r%}
t	j|
jd��|
�d}
~
wwxYw|�dS|r/|j)s(t	jd|j�d|�d|j�d�����j�*|��|S)a�Generate a new revision file.

        This runs the ``script.py.mako`` template, given
        template arguments, and creates a new file.

        :param revid: String revision id.  Typically this
         comes from ``alembic.util.rev_id()``.
        :param message: the revision message, the one passed
         by the -m argument to the ``revision`` command.
        :param head: the head revision to generate against.  Defaults
         to the current "head" if no branches are present, else raises
         an exception.
        :param splice: if True, allow the "head" version to not be an
         actual head; otherwise, the selected head must be a head
         (e.g. endpoint) revision.
        :param refresh: deprecated.

        Nr�rz{Multiple heads are present; please specify the head revision on which the new revision should be based, or perform a merge.r�r.r�z"Duplicate head revisions specifiedrzAMultiple version locations present, please specify --version-pathz7Path %s is not represented in current version locationszeRevision %s is not a head revision; please specify --splice to create a new branch from this revisionc�8�g|]\}}||jvr|n|j��SrJ)rr)rLr��deps   r@rNz5ScriptDirectory.generate_revision.<locals>.<listcomp>�sE��'�'�'�!��S��c�/�/�/��C���'�'�'rBc�b��g|]+}t�j�|����|f��,SrJ)rr8r�)rLr r?s  �r@rNz5ScriptDirectory.generate_revision.<locals>.<listcomp>�sG���%�%�%��"�$�"3�"@�"@��"E�"E�F�F��L�%�%�%rBzscript.py.makoc3�,K�|]}|�|jndV��dSr�r)rL�hs  r@�	<genexpr>z4ScriptDirectory.generate_revision.<locals>.<genexpr>�s,����K�K��A�M�a�j�j�t�K�K�K�K�K�KrBz
empty message)�up_revision�
down_revisionrrr�commarzVersion z specified branch_labels z, however the migration file zb does not have them; have you upgraded your script.py.mako to include the 'branch_labels' section?)+rW�
verify_rev_idrr�rr<r�r�rrrr8r�rErVrrD�
isinstancer9r=r]rG�normpathr>r(r�	_rev_path�is_head�to_listrrOr#r$�tuple_rev_as_scalar�tupler�r�r/r�
_run_hooks�
_from_pathr�add_revision)r?rrr�rrrrrr�r�r�r#r�head_�	norm_path�	vers_pathr=�resolved_depends_onrrres`                    r@�generate_revisionz!ScriptDirectory.generate_revisionysl���<�<��D�	:�� � ��'�'�'�'���%�	:�	:�	:��#�C�H�Q�K�0�0�c�9�����	:�����
(�
(�&�)�
�
�	#�	#���h�z�*�C�/�0��!�/�/��5�5���E��
#�
#���F�{�{�{�{�{�
#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#��s�5�z�z�?�?�c�%�j�j�(�(��#�$H�I�I�I��0�0�2�2�����4�*�+�+�a�/�/�"�	�	�E��(�)�%��8�8�8�8�8�')�w���u�z�'B�'B����)�
�+�8����� $�}���G�$�$�R�W�_�_�\�%B�%B�C�C�	��0�	�	�I��w���	�*�*�i�7�7���8��#�$�&2�3���
�
�!�	1��"�"�<�0�0�0��~�~�l�E�7�K�H�H���	��
�
���$�U�]�$��+�M��.�)������	'��,�,�.�.�	
�	
�'�'�%�%�%�%�#'�<�
�#;�#;�%�%�%�	'�'�'�#�	
�	
�	
�	
�	
�	
�	
�	
�	
�	
�	
����	
�	
�	
�	
��#'������G�L�L���#3�4�4��
	
��E�
�
�"�6��K�K�U�K�K�K�K�K����-�
�6�6��3�4G�H�H�#��&�&�2�G�G��
	
�
	
��
	
�
	
�
	
� �+���	;��"�4�)9�:�:�:�	:��&�&�t�T�2�2�F�F���%�	:�	:�	:��#�C�H�Q�K�0�0�c�9�����	:�����>��4��	��!5�	��#�#�
�?�?�?�M�M�M�6�;�;�;�	@���
�	
��&�&�v�.�.�.��
sQ�"�A� A�A�/AC
�
C�C�+K�K�K�"N>�>O2�
 O-�-O2�rev_idrc��t|�����}d�t�|pd�������}t
|��|jkr,|d|j��dd��ddz}d|j	||||j
|j|j|j
|j|jd�	zz}t j�||��S)N�_�rrz%s.py)	r��slug�epoch�year�month�day�hour�minute�second)rt�	timestamprO�_slug_re�findallr�rEr&�rsplitr%r>r?r@rArBrCr9r=)r?r=r8rrr=r<rcs        r@r+zScriptDirectory._rev_paths����K�)�)�+�+�,�,���x�x��(�(���B�7�7�8�8�>�>�@�@���t�9�9�t�0�0�0��3�$�3�3�4�;�;�C��C�C�A�F��L�D�������#�(�$�*�"��#�(�%�,�%�,�
�
�
�

���w�|�|�D�(�+�+�+rB)r#r$r%r$r&r'r(r)r*r+r,r$r-r.r/r0r1r+r2rr3r4�r3r$)r3rQ)rfrr3r )NNNNN)r�r.r�r.r�r.r�r.r�r.r3r�)r�r�)r�r$r�r$r3rQ)r�r�r3r�)r�r�r3r�)r�r$r3r�)r�r.r3r�)r�r�r�r�r�rr3rQ)r3r.)r3r�)r�r$r�r$r3r�)r�r$r�r.r3r�)rr�r�r�r3r�)r3r4)r�r$r�r$r�rr3r4)r�r$r�r$r3r4)r=r$r3r4)r3r	)NFFNNN)rr$rr.r�r.rr+rrrr.rr.rrr�rr3r�)
r=r$r8r$rr.rr	r3r$)'�__name__�
__module__�__qualname__�__doc__r}rr�
EMPTY_DICTrA�propertyrG�memoized_propertyrDr7�classmethodr�rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr7r+rJrBr@r r 5s���������,4�.0�15� �&�"&�37�,1�+/�4����,
�,
� � � � � �D�����X��
��J�J���J�����:�N
�N
�N
��[�N
�`�#'�(,�#�!�$(�
+:�+:�+:�+:��^�+:�\/6�(�(�(�(�(�&	�	�	�	�����
O�
O�
O�
O�����"
�
�
�
�48�8�8�8�0-�-�-�-�����,-�-�-�-�����$����$^�^�^�^�@	2�	2�	2�	2��A�A��X�A�I�I�I�I�#�#�#�#�"�"�"�"�����:#��!&�'+�&*�+/�Q�Q�Q�Q�Q�f,�,�,�,�,�,rBr c���eZdZUdZd%�fd�Zded<	ded<	dZd	ed
<	ed&d���Zed&d
���Z	ed&d���Z
d�Z					d'd(d�Z				d)d*d�Z
d&d�Zed+d���Zed,d!���Zed-d$���Z�xZS).rWz�Represent a single revision file in a ``versions/`` directory.

    The :class:`.Script` instance is returned by methods
    such as :meth:`.ScriptDirectory.iterate_revisions`.

    �modulerr8r$r=c���||_||_t���||jtjt|dd��d���tjt|dd��d������dS)NrrJ)�defaultr)r�dependencies)rRr=�superrAr&rr��getattr)r?rRr8r=�	__class__s    �r@rAzScript.__init__1s���������	�
������� ��-�����6�6����������d�3�3�R����
	�		
�		
�		
�		
�		
rBNr�_db_current_indicatorr3c�B�tjd|j��dS)�)Return the docstring given in the script.z

r)r�rw�longdocrPs r@�docz
Script.docIs���x����-�-�a�0�0rBc��|jj}|rHt|jd��r|�|jj��}|���SdS)r[�_alembic_source_encodingr;)rRrL�hasattr�decoder_�strip)r?r]s  r@r\zScript.longdocOs[���k�!���	��t�{�$>�?�?�
��j�j��K�8�����9�9�;�;���2rBc�j�d|j�|jrdnd�|jrdnd�|jrdnd�|jrdnd�d�}|jr|d|����d�z
}n|d	|����d�z
}|jr|d
tj|j��zz
}|jr|dtj|j	��zz
}|j
r |dtj|j
���d�z
}|d
|j�d�z
}|dd�d�|j
���D����zz
}|S)NzRev: � (head)r;� (branchpoint)�
 (mergepoint)�
 (current)�
zMerges: zParent: zAlso depends on: %s
zBranches into: %s
zBranch names: zPath: z
%s
c3� K�|]	}d|zV��
dS)z    %sNrJ)rL�paras  r@r$z#Script.log_entry.<locals>.<genexpr>}s&����L�L�$�h��o�L�L�L�L�L�LrB)rr,�is_branch_point�is_merge_pointrY�_format_down_revisionrUrr��nextrevrr=rOr\�
splitlines)r?�entrys  r@�	log_entryzScript.log_entry]s����
�M�M���-�I�I�2�-� $� 4�<���"�<�#�2�:�O�O��:� �6�>�L�L�B�>�>�
����	F��E�t�'A�'A�'C�'C�'C�'C�E�E�E�E��E�t�'A�'A�'C�'C�'C�'C�E�E�E���	��,��$�T�%6�7�7��
�E���	��*��$�T�\�2�2��
�E���	��E��$�T�%7�8�8�8�8��
�E�	������,�,��
���I�I�L�L�$�,�2I�2I�2K�2K�L�L�L�L�L�
�	
���rBc��|����d|j�|jrdnd�|jrdnd�|jrdnd�d|j��S)N� -> rdr;rerfz, )rmrr,rkrlr]rPs r@�__str__zScript.__str__�si���&�&�(�(�(�(��M�M���-�I�I�2�-� $� 4�<���"�<�#�2�:�O�O��:�:��H�H�

�	
rBFT�include_branchesr+�include_doc�include_parents�tree_indicators�head_indicatorsc���|j}|rT|jr4|����dtj|j���d|��}n|����d|��}|�J�|r&|jr|dtj|j��zz
}|s|r-||jrdnd�|jr	|jsdnd�|jrdnd��z
}|r||j	rd	nd�|j
rd
nd��z
}|r
|d|jzz
}|S)Nz (z) -> rsz (%s)rdr;z (effective head)rgrerfz, %s)rrUrmrr�r�
_is_real_headr,rYrkrlr])r?rurvrwrxry�texts       r@�
_head_onlyzScript._head_only�s}���}���	I�� �
I��.�.�0�0�0�0��(��):�;�;�;�;��D����&*�%?�%?�%A�%A�%A�%A�4�4�H�������	G�� 2�	G��G�d�2�4�3E�F�F�F�F�D��	�o�	��!�/�7�	�	�R�7��<��(,�(:��#�#���!%� :�B����B��
�D��	��$(�$8�@� � �b�@�#'�#6�>���B�>��
�D��	&��F�T�X�%�%�D��rB�verbosec�D�|r|jS|�||||��Sr�)rqr})r?r~rurvrwrxs      r@�
cmd_formatzScript.cmd_format�s3���	��>�!��?�?� �+�����
rBc�F�|jsdStj|j��S)Nz<base>)r&rr��_versioned_down_revisionsrPs r@rmzScript._format_down_revision�s'���!�	H��8��'��(F�G�G�GrB�	scriptdirr r�c�t�tj�|��\}}|�|||��Sr�)r9r=rwr^)rr�r=�dir_rcs     r@r1zScript._from_path�s3������t�,�,���h��!�!�)�T�8�<�<�<rBr�c�H��	�g}tj|d���D�]\}}}|�d��r�t|��D]5}|�tj�||�����6|jrtj�|d���	tj��	��r@d�|D���|�	��	fd�tj
�	��D����|jsn|�����|S)NT)�topdown�__pycache__c�D�h|]}|�d��d��S)�.r)rw)rLrcs  r@�	<setcomp>z&Script._list_py_dir.<locals>.<setcomp>�s)��J�J�J��X�^�^�C�0�0��3�J�J�JrBc3��K�|]A}|�d��d�v�tj��|��V��BdS)r�rN)rwr9r=rO)rL�pyc�names�
py_cache_paths  ��r@r$z&Script._list_py_dir.<locals>.<genexpr>�sY�����!�!���9�9�S�>�>�!�,�E�9�9�����]�C�8�8�9�9�9�9�!�!rB)
r9�walk�endswith�sortedr�r=rOr*rTr��listdirr1�sort)
rr�r=r_�root�dirs�filesrcr�r�s
        @@r@rXzScript._list_py_dir�s@������!#���t�!<�!<�!<�	�	��D�$���}�}�]�+�+�
��"�5�M�M�
;�
;�����R�W�\�\�$��9�9�:�:�:�:��#�
� "����T�=� A� A�
��7�>�>�-�0�0�	�K�J�E�J�J�J�E��L�L�!�!�!�!�!�#%�:�m�#<�#<�!�!�!�����8�
���
�I�I�K�K�K�K��rBr�rcc��|jrt�|��}nt�|��}|sdS|�d��}|jr3|�d��dk}|�d��dk}ndx}}|s|r�t
j�t
j�||����}t
j�t
j�||dz����}	|s|r|	rdStj
||��}
t|
d��sIt�|��}|stj
d|z���|�d��}n|
j}t|
|t
j�||����S)Nrr�c�oFrz�Could not determine revision id from filename %s. Be sure the 'revision' variable is declared inside the script (please see 'Upgrading from Alembic 0.1 to 0.2' in the documentation).)r*�_sourceless_rev_file�match�_only_source_rev_file�groupr9r=rTrOrr�r`�_legacy_revr<rrW)
rr�r�rc�py_match�py_filename�is_c�is_o�	py_exists�
pyc_existsrR�mrs
             r@r^zScript._from_filename�s�����	=�+�1�1�(�;�;�H�H�,�2�2�8�<�<�H��	��4��n�n�Q�'�'����	 ��>�>�!�$�$��+�D��>�>�!�$�$��+�D�D���D�4��	�4�	�����r�w�|�|�D�+�'F�'F�G�G�I���������T�;��;L�(M�(M�N�N�J�
�
�D�
�Z�
��t��&�t�X�6�6���v�z�*�*�	'��!�!�(�+�+�A��	
&��'�F��	�����7�7�1�:�:�����H��f�h�����T�8�(D�(D�E�E�ErB)rRrr8r$r=r$rH)FFFTT)rur+rvr+rwr+rxr+ryr+r3r$)FFFT)r~r+rur+rvr+rwr+rxr+r3r$)r�r r=r$r3r�)r�r r=r$r3r�)r�r r�r$rcr$r3r�)rIrJrKrLrA�__annotations__rYrNr]r\rqrtr}r�rmrPr1rXr^�
__classcell__)rXs@r@rWrW(s�����������
�
�
�
�
�
�����B�
�I�I�I�(�,0��0�0�0�0�4��1�1�1��X�1�
�����X���!�!�!��X�!�F
�
�
�"'�!� %� $� $�
$�$�$�$�$�R"'�!� %� $�

�
�
�
�
�H�H�H�H��=�=�=��[�=��"�"�"��[�"�H�/F�/F�/F��[�/F�/F�/F�/F�/FrBrW)6�
__future__r�
contextlibrr
r9r�rr|�typesr�typingrrrr	r
rrr
rrrr;rrr�runtimerrrfrr�runtime.migrationrr�script.revisionr�dateutilr�ImportErrorr$r��compiler�r�r��_mod_def_rerEr}rvr{r rWrJrBr@�<module>r�s?��"�"�"�"�"�"�%�%�%�%�%�%�����	�	�	�	�	�	�	�	�
�
�
�
�
�
�
�
������������������������������������������������������������� � � � � � ��������������������������������������+�������)�)�)�)�)�)�0�0�0�0�0�0�-�-�-�-�-�-�*�*�*�*�*�*��������������	
�B�B�B������3���
�%�
&�
�!�r�z�"E�F�F��"��
�#@�A�A���b�j�,�-�-���b�j�;�<�<���2�:�f����+��"��
�=�1�1��(�b�j�)9�:�:��p,�p,�p,�p,�p,�p,�p,�p,�fzF�zF�zF�zF�zF�X�
�zF�zF�zF�zF�zFs�(B/�/B9�8B9

Hacked By AnonymousFox1.0, Coded By AnonymousFox