MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / import_prefix

Method import_prefix

lib/sqlalchemy/util/preloaded.py:128–141  ·  view source on GitHub ↗

Resolve all the modules in the registry that start with the specified path.

(self, path: str)

Source from the content-addressed store, hash-verified

126 return lambda fn: fn
127
128 def import_prefix(self, path: str) -> None:
129 """Resolve all the modules in the registry that start with the
130 specified path.
131 """
132 for module in self.module_registry:
133 if self.prefix:
134 key = module.split(self.prefix)[-1].replace(".", "_")
135 else:
136 key = module
137 if (
138 not path or module.startswith(path)
139 ) and key not in self.__dict__:
140 __import__(module, globals(), locals())
141 self.__dict__[key] = globals()[key] = sys.modules[module]
142
143
144_reg = _ModuleRegistry()

Callers 5

__goFunction · 0.80
__goFunction · 0.80
__init__.pyFile · 0.80
__goFunction · 0.80

Calls 2

replaceMethod · 0.45
startswithMethod · 0.45

Tested by 1