(cls: Type[Any], key: str)
| 2154 | |
| 2155 | |
| 2156 | def _del_attribute(cls: Type[Any], key: str) -> None: |
| 2157 | if ( |
| 2158 | "__mapper__" in cls.__dict__ |
| 2159 | and key in cls.__dict__ |
| 2160 | and not cast( |
| 2161 | "MappedClassProtocol[Any]", cls |
| 2162 | ).__mapper__._dispose_called |
| 2163 | ): |
| 2164 | value = cls.__dict__[key] |
| 2165 | if isinstance( |
| 2166 | value, (Column, _MapsColumns, MapperProperty, QueryableAttribute) |
| 2167 | ): |
| 2168 | raise NotImplementedError( |
| 2169 | "Can't un-map individual mapped attributes on a mapped class." |
| 2170 | ) |
| 2171 | else: |
| 2172 | type.__delattr__(cls, key) |
| 2173 | cast( |
| 2174 | "MappedClassProtocol[Any]", cls |
| 2175 | ).__mapper__._expire_memoizations() |
| 2176 | else: |
| 2177 | type.__delattr__(cls, key) |
| 2178 | |
| 2179 | |
| 2180 | def _declarative_constructor(self: Any, **kwargs: Any) -> None: |
no test coverage detected