MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / get_attribute

Function get_attribute

lib/sqlalchemy/orm/attributes.py:2773–2784  ·  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

2771
2772
2773def get_attribute(instance: object, key: str) -> Any:
2774 """Get the value of an attribute, firing any callables required.
2775
2776 This function may be used regardless of instrumentation
2777 applied directly to the class, i.e. no descriptors are required.
2778 Custom attribute management schemes will need to make usage
2779 of this method to make usage of attribute state as understood
2780 by SQLAlchemy.
2781
2782 """
2783 state, dict_ = instance_state(instance), instance_dict(instance)
2784 return state.manager[key].impl.get(state, dict_)
2785
2786
2787def 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