MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _del_attribute

Function _del_attribute

lib/sqlalchemy/orm/decl_base.py:2256–2277  ·  view source on GitHub ↗
(cls: Type[Any], key: str)

Source from the content-addressed store, hash-verified

2254
2255
2256def _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
2280def _declarative_constructor(self: Any, **kwargs: Any) -> None:

Callers 1

__delattr__Method · 0.85

Calls 3

_expire_memoizationsMethod · 0.80
castFunction · 0.50
__delattr__Method · 0.45

Tested by

no test coverage detected