
    +h\	                     V    d Z ddlZddlmZ  G d d      Z e       Zej                  Zy)zRsupplies the "preloaded" registry to resolve circular module imports at
runtime.

    N   )compatc                   $    e Zd ZdZddZd Zd Zy)_ModuleRegistrya  Registry of modules to load in a package init file.

    To avoid potential thread safety issues for imports that are deferred
    in a function, like https://bugs.python.org/issue38884, these modules
    are added to the system module cache by importing them after the packages
    has finished initialization.

    A global instance is provided under the name :attr:`.preloaded`. Use
    the function :func:`.preload_module` to register modules to load and
    :meth:`.import_prefix` to load all the modules that start with the
    given path.

    While the modules are loaded in the global module cache, it's advisable
    to access them using :attr:`.preloaded` to ensure that it was actually
    registered. Each registered module is added to the instance ``__dict__``
    in the form `<package>_<module>`, omitting ``sqlalchemy`` from the package
    name. Example: ``sqlalchemy.sql.util`` becomes ``preloaded.sql_util``.
    c                 0    t               | _        || _        y N)setmodule_registryprefix)selfr   s     M/var/www/html/venv/lib/python3.12/site-packages/sqlalchemy/util/_preloaded.py__init__z_ModuleRegistry.__init__&   s    "u    c                 >    | j                   j                  |       d S )zAdds the specified modules to the list to load.

        This method can be used both as a normal function and as a decorator.
        No change is performed to the decorated object.
        c                     | S r    )fns    r   <lambda>z0_ModuleRegistry.preload_module.<locals>.<lambda>1   s    " r   )r
   update)r   depss     r   preload_modulez_ModuleRegistry.preload_module*   s     	##D)r   c                 t   | j                   D ]  }| j                  r/|j                  | j                        d   j                  dd      }n|}|r|j	                  |      sT|| j
                  vsct        j                  |t               t                      t        j                  |   | j
                  |<    y)z\Resolve all the modules in the registry that start with the
        specified path.
        ._N)r
   r   splitreplace
startswith__dict__r   import_globalslocalssysmodules)r   pathmodulekeys       r   import_prefixz_ModuleRegistry.import_prefix3   s     ** 		9F{{ll4;;/3;;CEF--d3T]]*vwy&(;%([[%8c"		9r   N)zsqlalchemy.)__name__
__module____qualname____doc__r   r   r(   r   r   r   r   r      s    &9r   r   )r,   r#    r   r   	preloadedr   r   r   r   <module>r/      s2   
  .9 .9b 	))r   