File: //usr/local/lib/python3.10/dist-packages/sqlalchemy/util/__pycache__/preloaded.cpython-310.pyc
o
���g � @ s� d Z ddlmZ ddlZddlmZ ddlmZ ddlmZ ddlmZ eded ef d
�Z e�r1ddl
mZ ddl
m
Z dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm!Z" ddlm#Z$ ddlm%Z& ddlm'Z( ddlm)Z* ddlm+Z, ddlm-Z. ddlm/Z0 ddlm1Z2 ddlm3Z4 ddlm5Z6 dd lm7Z8 dd!l9m:Z; dd"l9m<Z= dd#l9m>Z? dd$l9m@ZA dd%l9mBZC dd&l9mDZE dd'l9mFZG dd(l9mHZI dd)l9mJZK dd l9m7ZL eZeZMeZNeZOeZPeZQe ZReZSeZ
eZTe"ZUe$ZVe(ZWe&ZXe*ZYe,ZZe.Z[e0Z\e4Z]e6Z^e2Z_e8Z`e;Zae=Zbe?ZceAZdeCZeeGZfeKZgeEZheIZieLZjG d*d+� d+�Zkek� ZleljmZmeljnZndS ),zRsupplies the "preloaded" registry to resolve circular module imports at
runtime.
� )�annotationsN)�Any)�Callable)�
TYPE_CHECKING)�TypeVar�_FN.)�bound)�dialects)�orm)�cursor)�default)�
reflection)�result)�url)�
attributes)�base)�clsregistry)�decl_api)� decl_base)�
dependency)�descriptor_props)� mapperlib)�
properties)�
relationships)�session)�state)�
strategies)�strategy_options)�util)�default_comparator)�dml)�elements)� functions)�naming)�schema)�
selectable)�sqltypes)�
traversalsc @ s. e Zd ZdZddd�Zdd d
�Zdd
d�ZdS )�_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``.
�sqlalchemy.c C s t � | _|| _d S �N)�set�module_registry�prefix)�selfr- � r/ �D/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/preloaded.py�__init__r s
z_ModuleRegistry.__init__�deps�str�return�Callable[[_FN], _FN]c G s | j �|� dd� S )z�Adds 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 s | S r* r/ )�fnr/ r/ r0 �<lambda>} s z0_ModuleRegistry.preload_module.<locals>.<lambda>)r, �update)r. r2 r/ r/ r0 �preload_modulev s z_ModuleRegistry.preload_module�path�Nonec C sv | j D ]5}| jr|�| j�d �dd�}n|}|r|�|�r8|| jvr8t|t� t� � t j
| | j|<