MCPcopy Index your code
hub / github.com/sqlalchemy/sqlalchemy / _add_getter

Method _add_getter

lib/sqlalchemy/sql/lambdas.py:1419–1437  ·  view source on GitHub ↗
(self, key, getter_fn)

Source from the content-addressed store, hash-verified

1417 return self._sa__add_getter(key, operator.itemgetter)
1418
1419 def _add_getter(self, key, getter_fn):
1420 bind_paths = object.__getattribute__(self, "_bind_paths")
1421
1422 bind_path_key = (key, getter_fn)
1423 if bind_path_key in bind_paths:
1424 return bind_paths[bind_path_key]
1425
1426 getter = getter_fn(key)
1427 elem = object.__getattribute__(self, "_to_evaluate")
1428 value = getter(elem)
1429
1430 rolled_down_value = AnalyzedCode._roll_down_to_literal(value)
1431
1432 if coercions._deep_is_literal(rolled_down_value):
1433 wrapper = PyWrapper(self._sa_fn, key, value, getter=getter)
1434 bind_paths[bind_path_key] = wrapper
1435 return wrapper
1436 else:
1437 return value
1438
1439
1440@inspection._inspects(LambdaElement)

Callers

nothing calls this directly

Calls 3

PyWrapperClass · 0.85
_roll_down_to_literalMethod · 0.80
__getattribute__Method · 0.45

Tested by

no test coverage detected