(
registries: Set[_RegistryType], cascade: bool
)
| 4198 | |
| 4199 | |
| 4200 | def _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") |
no test coverage detected