(
self,
finalize: bool = False,
mapper: Optional[Mapper[_O]] = None,
registry: Optional[_RegistryType] = None,
declarative_scan: Optional[_MapperConfig] = None,
expired_attribute_loader: Optional[
_ExpiredAttributeLoaderProto
] = None,
init_method: Optional[Callable[..., None]] = None,
)
| 183 | ) |
| 184 | |
| 185 | def _update_state( |
| 186 | self, |
| 187 | finalize: bool = False, |
| 188 | mapper: Optional[Mapper[_O]] = None, |
| 189 | registry: Optional[_RegistryType] = None, |
| 190 | declarative_scan: Optional[_MapperConfig] = None, |
| 191 | expired_attribute_loader: Optional[ |
| 192 | _ExpiredAttributeLoaderProto |
| 193 | ] = None, |
| 194 | init_method: Optional[Callable[..., None]] = None, |
| 195 | ) -> None: |
| 196 | if mapper: |
| 197 | self.mapper = mapper # |
| 198 | if registry: |
| 199 | registry._add_manager(self) |
| 200 | if declarative_scan: |
| 201 | self.declarative_scan = weakref.ref(declarative_scan) |
| 202 | if expired_attribute_loader: |
| 203 | self.expired_attribute_loader = expired_attribute_loader |
| 204 | |
| 205 | if init_method: |
| 206 | assert not self._finalized, ( |
| 207 | "class is already instrumented, " |
| 208 | "init_method %s can't be applied" % init_method |
| 209 | ) |
| 210 | self.init_method = init_method |
| 211 | |
| 212 | if not self._finalized: |
| 213 | self.original_init = ( |
| 214 | self.init_method |
| 215 | if self.init_method is not None |
| 216 | and self.class_.__init__ is object.__init__ |
| 217 | else self.class_.__init__ |
| 218 | ) |
| 219 | |
| 220 | if finalize and not self._finalized: |
| 221 | self._finalize() |
| 222 | |
| 223 | def _finalize(self) -> None: |
| 224 | if self._finalized: |
no test coverage detected