U ÃÏ a  ã@s6dZddlZddlmZGdd„dƒZeƒZejZdS)zRsupplies the "preloaded" registry to resolve circular module imports at runtime. éNé)Úcompatc@s*eZdZdZd dd„Zdd„Zdd„Zd 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 `_`, omitting ``sqlalchemy`` from the package name. Example: ``sqlalchemy.sql.util`` becomes ``preloaded.sql_util``. ú sqlalchemy.cCstƒ|_||_dS©N)ÚsetÚmodule_registryÚprefix)Úselfr ©r ú[C:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-nyjtotrf\sqlalchemy\util\_preloaded.pyÚ__init__&sz_ModuleRegistry.__init__cGs|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. cSs|Srr )Úfnr r r Ú1óz0_ModuleRegistry.preload_module..)rÚupdate)r Údepsr r r Úpreload_module*s z_ModuleRegistry.preload_modulecCsn|jD]b}|jr*| |j¡d dd¡}n|}|r<| |¡r||jkrt |tƒt ƒ¡t j ||j|<qdS)z\Resolve all the modules in the registry that start with the specified path. éÿÿÿÿÚ.Ú_N) rr ÚsplitÚreplaceÚ startswithÚ__dict__rÚimport_ÚglobalsÚlocalsÚsysÚmodules)r ÚpathÚmoduleÚkeyr r r Ú import_prefix3s ÿÿþz_ModuleRegistry.import_prefixN)r)Ú__name__Ú __module__Ú __qualname__Ú__doc__r rr#r r r r rs  r)r'rÚrrZ preloadedrr r r r Ús  1