MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _configure_registries

Function _configure_registries

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

Source from the content-addressed store, hash-verified

4182
4183
4184def _configure_registries(
4185 registries: Set[_RegistryType], cascade: bool
4186) -> None:
4187 for reg in registries:
4188 if reg._new_mappers:
4189 break
4190 else:
4191 return
4192
4193 with _CONFIGURE_MUTEX:
4194 global _already_compiling
4195 if _already_compiling:
4196 return
4197 _already_compiling = True
4198 try:
4199 # double-check inside mutex
4200 for reg in registries:
4201 if reg._new_mappers:
4202 break
4203 else:
4204 return
4205
4206 Mapper.dispatch._for_class(Mapper).before_configured() # type: ignore # noqa: E501
4207
4208 # initialize properties on all mappers
4209 # note that _mapper_registry is unordered, which
4210 # may randomly conceal/reveal issues related to
4211 # the order of mapper compilation
4212
4213 registries_configured = list(
4214 _do_configure_registries(registries, cascade)
4215 )
4216
4217 finally:
4218 _already_compiling = False
4219 for reg in registries_configured:
4220 reg.dispatch.after_configured(reg)
4221 Mapper.dispatch._for_class(Mapper).after_configured() # type: ignore
4222
4223
4224@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