MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _roll_down_to_literal

Method _roll_down_to_literal

lib/sqlalchemy/sql/lambdas.py:878–901  ·  view source on GitHub ↗
(cls, element)

Source from the content-addressed store, hash-verified

876
877 @classmethod
878 def _roll_down_to_literal(cls, element):
879 is_clause_element = hasattr(element, "__clause_element__")
880
881 if is_clause_element:
882 while not isinstance(
883 element, (elements.ClauseElement, schema.SchemaItem, type)
884 ):
885 try:
886 element = element.__clause_element__()
887 except AttributeError:
888 break
889
890 if not is_clause_element:
891 insp = inspection.inspect(element, raiseerr=False)
892 if insp is not None:
893 try:
894 return insp.__clause_element__()
895 except AttributeError:
896 return insp
897
898 # TODO: should we coerce consts None/True/False here?
899 return element
900 else:
901 return element
902
903 def _bound_parameter_getter_func_globals(self, name):
904 """Return a getter that will extend a list of bound parameters

Callers 3

_init_globalsMethod · 0.95
_init_closureMethod · 0.95
_add_getterMethod · 0.80

Calls 1

__clause_element__Method · 0.45

Tested by

no test coverage detected