(cls: Type[Any], key: str)
| 2254 | |
| 2255 | |
| 2256 | def _del_attribute(cls: Type[Any], key: str) -> None: |
| 2257 | if ( |
| 2258 | "__mapper__" in cls.__dict__ |
| 2259 | and key in cls.__dict__ |
| 2260 | and not cast( |
| 2261 | "MappedClassProtocol[Any]", cls |
| 2262 | ).__mapper__._dispose_called |
| 2263 | ): |
| 2264 | value = cls.__dict__[key] |
| 2265 | if isinstance( |
| 2266 | value, (Column, _MapsColumns, MapperProperty, QueryableAttribute) |
| 2267 | ): |
| 2268 | raise NotImplementedError( |
| 2269 | "Can't un-map individual mapped attributes on a mapped class." |
| 2270 | ) |
| 2271 | else: |
| 2272 | type.__delattr__(cls, key) |
| 2273 | cast( |
| 2274 | "MappedClassProtocol[Any]", cls |
| 2275 | ).__mapper__._expire_memoizations() |
| 2276 | else: |
| 2277 | type.__delattr__(cls, key) |
| 2278 | |
| 2279 | |
| 2280 | def _declarative_constructor(self: Any, **kwargs: Any) -> None: |
no test coverage detected