MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / fget

Method fget

lib/sqlalchemy/orm/descriptor_props.py:311–329  ·  view source on GitHub ↗
(instance: Any)

Source from the content-addressed store, hash-verified

309 """
310
311 def fget(instance: Any) -> Any:
312 dict_ = attributes.instance_dict(instance)
313 state = attributes.instance_state(instance)
314
315 if self.key not in dict_:
316 # key not present. Iterate through related
317 # attributes, retrieve their values. This
318 # ensures they all load.
319 values = [
320 getattr(instance, key) for key in self._attribute_keys
321 ]
322
323 if self.key not in dict_:
324 dict_[self.key] = self._construct_composite(*values)
325 state.manager.dispatch.refresh(
326 state, self._COMPOSITE_FGET, [self.key]
327 )
328
329 return dict_.get(self.key, None)
330
331 def fset(instance: Any, value: Any) -> None:
332 if value is LoaderCallableStatus.DONT_SET:

Callers 4

__get__Method · 0.45
__getattribute__Method · 0.45
_scan_attributesMethod · 0.45
_scan_attributesMethod · 0.45

Calls 3

_construct_compositeMethod · 0.95
refreshMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected