§
    äóÉjø  ã                  ó  — U d dl mZ d dlmZ d dlZd dlZd dlmZ d dlmZ d dl	m
Z
 d dl	mZ dd	lmZ dd
lmZ ddlmZ erddlmZ i Zded<    ej        e¦  «        Z G d„ d¦  «        ZddiZdd„Zdd„Zdd„Z e¦   «          dS )é    )Úannotations)ÚmetadataN)ÚPattern)Ú
ModuleType)ÚCallable)ÚTYPE_CHECKINGé   )Úutil)ÚDispatchPriority)ÚPriorityDispatcher)ÚPriorityDispatchResultzdict[str, Plugin]Ú_all_pluginsc                  óp   — e Zd ZdZdd„Zdd„Z	 dd	ej        d
œdd„Ze	d d„¦   «         Z
e	d!d„¦   «         ZdS )"ÚPlugina  Describe a series of functions that are pulled in as a plugin.

    This is initially to provide for portable lists of autogenerate
    comparison functions, however the setup for a plugin can run any
    other kinds of global registration as well.

    .. versionadded:: 1.18.0

    ÚnameÚstrc                ó¼   — || _         t                               d|¦  «         |t          v rt	          d|› d�¦  «        ‚| t          |<   t          ¦   «         | _        d S )Nzsetup plugin %szA plugin named z is already registered)r   ÚlogÚinfor   Ú
ValueErrorr   Úautogenerate_comparators)Úselfr   s     úz/home/lighthouse/badge-speaker-benchmark/.benchmark-venv-community/lib/python3.11/site-packages/alembic/runtime/plugins.pyÚ__init__zPlugin.__init__#   sa   € ØˆŒ	Ý�ŠÐ" DÑ)Ô)Ð)Ø•<ÐÐÝÐK¨tÐKÐKÐKÑLÔLÐLØ!��TÑÝ(:Ñ(<Ô(<ˆÔ%Ð%Ð%ó    ÚreturnÚNonec                ó    — t           | j        = dS )zremove this pluginN)r   r   )r   s    r   ÚremovezPlugin.remove+   s   € õ ˜œÐ#Ð#Ð#r   NÚdefault)Ú	qualifierÚpriorityÚfnú%Callable[..., PriorityDispatchResult]Úcompare_targetÚcompare_elementú
str | Noner!   r"   r   c               óT   —  | j                              ||||¬¦  «        |¦  «         dS )aU  Register an autogenerate comparison function.

        See the section :ref:`plugins_registering_autogenerate` for detailed
        examples on how to use this method.

        :param fn: The comparison function to register. The function receives
         arguments specific to the type of comparison being performed and
         should return a :class:`.PriorityDispatchResult` value.

        :param compare_target: The type of comparison being performed
         (e.g., ``"table"``, ``"column"``, ``"type"``).

        :param compare_element: Optional sub-element being compared within
         the target type.

        :param qualifier: Database dialect qualifier. Use ``"default"`` for
         all dialects, or specify a dialect name like ``"postgresql"`` to
         register a dialect-specific handler. Defaults to ``"default"``.

        :param priority: Execution priority for this comparison function.
         Functions are executed in priority order from
         :attr:`.DispatchPriority.FIRST` to :attr:`.DispatchPriority.LAST`.
         Defaults to :attr:`.DispatchPriority.MEDIUM`.

        )Úsubgroupr"   r!   N)r   Údispatch_for)r   r#   r%   r&   r!   r"   s         r   Úadd_autogenerate_comparatorz"Plugin.add_autogenerate_comparator0   sL   € ðD	
ˆÔ%×2Ò2ØØ$ØØð	 	3ñ 	
ô 	
ð
 ñ	ô 	ð 	ð 	ð 	r   Úcomparatorsr   Úinclude_pluginsú	list[str]c           
     óö  ‡‡	— t          ¦   «         }i Št          ¦   «         }|D ]n}|                     d¦  «        r8|                     t          t	          |dd…         ¦  «        ¦  «        ¦  «         ŒOt          t	          |¦  «        ¦  «        ‰|<   Œot
                               ¦   «         D ]Š	t          ˆ	fd„|D ¦   «         ¦  «        rŒˆˆ	fd„‰D ¦   «         }|sŒ0|                     |¦  «         t           
                    d‰	j        ¦  «         |                     ‰	j        ¦  «         Œ€t          ‰¦  «                             |¦  «        }|r*t          j        dd                     |¦  «        › �¦  «        ‚dS )	z_Populate all current autogenerate comparison functions into
        a given PriorityDispatcher.ú~é   Nc              3  óL   •K  — | ]}|                      ‰j        ¦  «        V — Œd S ©N©Úmatchr   )Ú.0ÚexclÚplugins     €r   ú	<genexpr>zAPlugin.populate_autogenerate_priority_dispatch.<locals>.<genexpr>n   s1   øè è € Ð?Ð?¨t�4—:’:˜fœkÑ*Ô*Ð?Ð?Ð?Ð?Ð?Ð?r   c                óT   •— g | ]$}‰|                               ‰j        ¦  «        ¯"|‘Œ%S © r4   )r6   ÚinclÚincluder8   s     €€r   ú
<listcomp>zBPlugin.populate_autogenerate_priority_dispatch.<locals>.<listcomp>q   sB   ø€ ð ð ð Ø¨G°D¬M×,?Ò,?ÀÄÑ,LÔ,LðØðð ð r   z!setting up autogenerate plugin %szDid not locate plugins: z, )ÚsetÚ
startswithÚaddÚ_make_reÚ_translate_legacy_namer   ÚvaluesÚanyÚupdater   r   r   Úpopulate_withr   Ú
differencer
   ÚCommandErrorÚjoin)
Úclsr,   r-   ÚexcludeÚmatched_expressionsr   Úinclude_matchesÚnever_matchedr=   r8   s
           @@r   Ú'populate_autogenerate_priority_dispatchz.Plugin.populate_autogenerate_priority_dispatchY   s¬  øø€ õ &)¡U¤UˆØ+-ˆå(+©¬Ðà#ð 	Gð 	GˆDð �Š˜sÑ#Ô#ð GØ—’�HÕ%;¸DÀÀÀ¼HÑ%EÔ%EÑFÔFÑGÔGÐGÐGå (Õ)?ÀÑ)EÔ)EÑ FÔ F�˜‘�å"×)Ò)Ñ+Ô+ð 	Gð 	GˆFÝÐ?Ð?Ð?Ð?°wÐ?Ñ?Ô?Ñ?Ô?ð Øðð ð ð ð Ø!(ðñ ô ˆOð #ð <Øà#×*Ò*¨?Ñ;Ô;Ð;å�HŠHÐ8¸&¼+ÑFÔFÐFØ×%Ò% fÔ&EÑFÔFÐFÐFå˜G™œ×/Ò/Ð0CÑDÔDˆØð 	ÝÔ#ØE¨4¯9ª9°]Ñ+CÔ+CÐEÐEñô ð ð	ð 	r   Úmoduler   c                óJ   — |                      t          |¦  «        ¦  «         dS )a<  Call the ``setup()`` function of a plugin module, identified by
        passing the module object itself.

        E.g.::

            from alembic.runtime.plugins import Plugin
            import myproject.alembic_plugin

            # Register the plugin manually
            Plugin.setup_plugin_from_module(
                myproject.alembic_plugin,
                "myproject.custom_operations"
            )

        This will generate a new :class:`.Plugin` object with the given
        name, which will register itself in the global list of plugins.
        Then the module's ``setup()`` function is invoked, passing that
        :class:`.Plugin` object.

        This exact process is invoked automatically at import time for any
        plugin module that is published via the ``alembic.plugins`` entrypoint.

        N)Úsetupr   )rK   rQ   r   s      r   Úsetup_plugin_from_modulezPlugin.setup_plugin_from_module‚   s"   € ð2 	�Š•V˜D‘\”\Ñ"Ô"Ð"Ð"Ð"r   )r   r   ©r   r   r3   )r#   r$   r%   r   r&   r'   r!   r   r"   r   r   r   )r,   r   r-   r.   r   r   )rQ   r   r   r   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   ÚMEDIUMr+   ÚclassmethodrP   rT   r;   r   r   r   r      s»   € € € € € ðð ð=ð =ð =ð =ð$ð $ð $ð $ð '+ð	'ð #Ø%5Ô%<ð'ð 'ð 'ð 'ð 'ð 'ðR ð&ð &ð &ñ „[ð&ðP ð#ð #ð #ñ „[ð#ð #ð #r   r   z+alembic.autogenerate.checkconstraint_bynamez"alembic.ext.checkconstraint_bynamer   r   r   c                ó8   — t                                | | ¦  «        S )a@  Resolve a plugin name that has been renamed to its current name.

    This allows an ``env.py`` written against an earlier Alembic release to
    keep working, whether the name is used to include or to exclude the
    plugin.  Wildcard expressions are never translated, as only fully
    stated names are eligible.

    )Ú_legacy_plugin_namesÚget)r   s    r   rC   rC   ¨   s   € õ  ×#Ò# D¨$Ñ/Ô/Ð/r   úPattern[str]c                óî   — |                       d¦  «        }d}|D ]<}|dk    r|dz  }Œ|                     ¦   «         r	|d|z   z  }Œ+t          d| ›�¦  «        ‚t          j        d|dd …         › d	�¦  «        S )
Nú.Ú Ú*z\..+?z\.zInvalid plugin expression ú^r	   ú$)ÚsplitÚisidentifierr   ÚreÚcompile)r   ÚtokensÚregÚtokens       r   rB   rB   ´   s™   € Ø�ZŠZ˜‰_Œ_€Fà
€CØð Dð DˆØ�CŠ<ˆ<Ø�8‰OˆCˆCØ×ÒÑ!Ô!ð 	DØ�5˜5‘=Ñ ˆCˆCåÐB¸$ÐBÐBÑCÔCÐCõ Œ:�n˜#˜a˜b˜bœ'�n�n�nÑ%Ô%Ð%r   r   c                 ó¤   — t          j        d¬¦  «        D ]9} |                      ¦   «         D ]"}t                               || j        ¦  «         Œ#Œ:d S )Nzalembic.plugins)Úgroup)r   Úentry_pointsÚloadr   rT   r   )Ú
entrypointÚmods     r   Ú_setuprs   Ä   sj   € åÔ+Ð2CÐDÑDÔDð Bð Bˆ
Ø—?’?Ñ$Ô$ð 	Bð 	BˆCÝ×+Ò+¨C°´ÑAÔAÐAÐAð	BðBð Br   )r   r   r   r   )r   r   r   r_   rU   )Ú
__future__r   Ú	importlibr   Úloggingrh   r   Útypesr   Útypingr   r   rb   r
   r   r   r   r   Ú__annotations__Ú	getLoggerrV   r   r   r]   rC   rB   rs   r;   r   r   ú<module>r{      s�  ðØ "Ð "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ð Ð Ø €€€Ø 	€	€	€	Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø  Ð  Ð  Ð  Ð  Ð  à Ð Ð Ð Ð Ð Ø #Ð #Ð #Ð #Ð #Ð #Ø %Ð %Ð %Ð %Ð %Ð %àð .Ø-Ð-Ð-Ð-Ð-Ð-à"$€Ð $Ð $Ð $Ñ $ð €gÔ˜Ñ!Ô!€ðC#ð C#ð C#ð C#ð C#ñ C#ô C#ð C#ðT 2Ø,ðÐ ð	0ð 	0ð 	0ð 	0ð&ð &ð &ð &ð Bð Bð Bð Bð €�„€€€r   