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

Function _configure_registries

lib/sqlalchemy/orm/mapper.py:4200–4231  ·  view source on GitHub ↗
(
    registries: Set[_RegistryType], cascade: bool
)

Source from the content-addressed store, hash-verified

4198
4199
4200def _configure_registries(
4201 registries: Set[_RegistryType], cascade: bool
4202) -> None:
4203 for reg in registries:
4204 if reg._new_mappers:
4205 break
4206 else:
4207 return
4208
4209 with _CONFIGURE_MUTEX:
4210 global _already_compiling
4211 if _already_compiling:
4212 return
4213 _already_compiling = True
4214 try:
4215 # double-check inside mutex
4216 for reg in registries:
4217 if reg._new_mappers:
4218 break
4219 else:
4220 return
4221
4222 Mapper.dispatch._for_class(Mapper).before_configured() # type: ignore # noqa: E501
4223 # initialize properties on all mappers
4224 # note that _mapper_registry is unordered, which
4225 # may randomly conceal/reveal issues related to
4226 # the order of mapper compilation
4227
4228 _do_configure_registries(registries, cascade)
4229 finally:
4230 _already_compiling = False
4231 Mapper.dispatch._for_class(Mapper).after_configured() # type: ignore
4232
4233
4234@util.preload_module("sqlalchemy.orm.decl_api")

Callers 2

_check_configureMethod · 0.85
configure_mappersFunction · 0.85

Calls 4

_do_configure_registriesFunction · 0.85
_for_classMethod · 0.80
before_configuredMethod · 0.45
after_configuredMethod · 0.45

Tested by

no test coverage detected