MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / get_attribute

Function get_attribute

lib/sqlalchemy/orm/attributes.py:2798–2809  ·  view source on GitHub ↗

Get the value of an attribute, firing any callables required. This function may be used regardless of instrumentation applied directly to the class, i.e. no descriptors are required. Custom attribute management schemes will need to make usage of this method to make usage of attribut

(instance: object, key: str)

Source from the content-addressed store, hash-verified

2796
2797
2798def get_attribute(instance: object, key: str) -> Any:
2799 """Get the value of an attribute, firing any callables required.
2800
2801 This function may be used regardless of instrumentation
2802 applied directly to the class, i.e. no descriptors are required.
2803 Custom attribute management schemes will need to make usage
2804 of this method to make usage of attribute state as understood
2805 by SQLAlchemy.
2806
2807 """
2808 state, dict_ = instance_state(instance), instance_dict(instance)
2809 return state.manager[key].impl.get(state, dict_)
2810
2811
2812def del_attribute(instance: object, key: str) -> None:

Callers 2

__getattr__Method · 0.90
__getattr__Method · 0.90

Calls 3

instance_stateFunction · 0.85
instance_dictFunction · 0.85
getMethod · 0.45

Tested by 1

__getattr__Method · 0.72