U
    d                     @  s  d Z ddlm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 eded	ef d
Z	erbd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 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( ddlm)Z* ddlm+Z, ddlm-Z. ddlm/Z0 ddlm1Z2 ddlm3Z4 ddlm5Z6 dd lm7Z8 dd!l9m:Z; dd"l9m<Z= dd#l9m>Z? dd$l9m@ZA dd%l9mBZC dd&l9mDZE dd'l9mFZG dd(l9mHZI dd)l9mJZK dd l9m7ZL eZeZMeZNeZOeZPeZQe ZReZSeZeZTe"ZUe$ZVe(ZWe&ZXe*ZYe,ZZe.Z[e0Z\e4Z]e6Z^e2Z_e8Z`e;Zae=Zbe?ZceAZdeCZeeGZfeKZgeEZheIZieLZjG d*d+ d+Zkek ZleljmZmeljnZndS ),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 Zd ZdZdddZddddd	Zdd
dddZdS )_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/   =/tmp/pip-unpacked-wheel-wbr0uges/sqlalchemy/util/preloaded.py__init__r   s    z_ModuleRegistry.__init__strzCallable[[_FN], _FN])depsreturnc                 G  s   | j | d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  s   | S r*   r/   )fnr/   r/   r0   <lambda>}       z0_ModuleRegistry.preload_module.<locals>.<lambda>)r,   update)r.   r3   r/   r/   r0   preload_modulev   s    z_ModuleRegistry.preload_moduleNone)pathr4   c                 C  sv   | j D ]j}| jr*|| jd dd}n|}|r<||r|| jkrt|t t  t	j
|  | j|< t |< qdS )z\Resolve all the modules in the registry that start with the
        specified path.
        ._N)r,   r-   splitreplace
startswith__dict__
__import__globalslocalssysmodules)r.   r;   modulekeyr/   r/   r0   import_prefix   s    
z_ModuleRegistry.import_prefixN)r)   )__name__
__module____qualname____doc__r1   r9   rJ   r/   r/   r/   r0   r(   ^   s   
	r(   )orN   
__future__r   rF   typingr   r   r   r   r   Z
sqlalchemyr	   	_dialectsr
   Z_ormZsqlalchemy.enginer   Z_engine_cursorr   Z_engine_defaultr   Z_engine_reflectionr   Z_engine_resultr   Z_engine_urlZsqlalchemy.ormr   Z_orm_attributesr   Z	_orm_baser   Z_orm_clsregistryr   Z_orm_decl_apir   Z_orm_decl_baser   Z_orm_dependencyr   Z_orm_descriptor_propsr   Z_orm_mapperr   Z_orm_propertiesr   Z_orm_relationshipsr   Z_orm_sessionr   Z
_orm_stater   Z_orm_strategiesr   Z_orm_strategy_optionsr   Z	_orm_utilZsqlalchemy.sqlr   Z_sql_default_comparatorr    Z_sql_dmlr!   Z_sql_elementsr"   Z_sql_functionsr#   Z_sql_namingr$   Z_sql_schemar%   Z_sql_selectabler&   Z_sql_sqltypesr'   Z_sql_traversalsZ	_sql_utilZengine_cursorZengine_defaultZengine_reflectionZengine_resultZ
engine_urlZorm_clsregistryZorm_baseZorm_attributesZorm_decl_apiZorm_decl_baseZorm_descriptor_propsZorm_dependencyZ
orm_mapperZorm_propertiesZorm_relationshipsZorm_sessionZorm_strategiesZorm_strategy_optionsZ	orm_stateZorm_utilZsql_default_comparatorZsql_dmlZsql_elementsZsql_functionsZ
sql_namingZsql_selectableZsql_traversalsZ
sql_schemaZsql_sqltypesZsql_utilr(   Z_regr9   rJ   r/   r/   r/   r0   <module>	   s   1