o
    Šåg  ã                   @  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�r1d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
„Z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/   úU/var/www/html/flaskapp/venv/lib/python3.10/site-packages/sqlalchemy/util/preloaded.pyÚ__init__r   s   
z_ModuleRegistry.__init__ÚdepsÚstrÚreturnúCallable[[_FN], _FN]c                 G  s   | j  |¡ dd„ 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}| jr| | j¡d  dd¡}n|}|r| |¡r8|| jvr8t|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)   )r2   r3   r4   r5   )r:   r3   r4   r;   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r1   r9   rJ   r/   r/   r/   r0   r(   ^   s
    

	r(   )orN   Ú
__future__r   rF   Útypingr   r   r   r   r   Ú
sqlalchemyr	   Ú	_dialectsr
   Ú_ormÚsqlalchemy.enginer   Ú_engine_cursorr   Ú_engine_defaultr   Ú_engine_reflectionr   Ú_engine_resultr   Ú_engine_urlÚsqlalchemy.ormr   Ú_orm_attributesr   Ú	_orm_baser   Ú_orm_clsregistryr   Ú_orm_decl_apir   Ú_orm_decl_baser   Ú_orm_dependencyr   Ú_orm_descriptor_propsr   Ú_orm_mapperr   Ú_orm_propertiesr   Ú_orm_relationshipsr   Ú_orm_sessionr   Ú
_orm_stater   Ú_orm_strategiesr   Ú_orm_strategy_optionsr   Ú	_orm_utilÚsqlalchemy.sqlr   Ú_sql_default_comparatorr    Ú_sql_dmlr!   Ú_sql_elementsr"   Ú_sql_functionsr#   Ú_sql_namingr$   Ú_sql_schemar%   Ú_sql_selectabler&   Ú_sql_sqltypesr'   Ú_sql_traversalsÚ	_sql_utilÚengine_cursorÚengine_defaultÚengine_reflectionÚengine_resultÚ
engine_urlÚorm_clsregistryÚorm_baseÚorm_attributesÚorm_decl_apiÚorm_decl_baseÚorm_descriptor_propsÚorm_dependencyÚ
orm_mapperÚorm_propertiesÚorm_relationshipsÚorm_sessionÚorm_strategiesÚorm_strategy_optionsÚ	orm_stateÚorm_utilÚsql_default_comparatorÚsql_dmlÚsql_elementsÚsql_functionsÚ
sql_namingÚsql_selectableÚsql_traversalsÚ
sql_schemaÚsql_sqltypesÚsql_utilr(   Ú_regr9   rJ   r/   r/   r/   r0   Ú<module>   sš   1
