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

Method _roll_down_to_literal

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

Source from the content-addressed store, hash-verified

875
876 @classmethod
877 def _roll_down_to_literal(cls, element):
878 is_clause_element = hasattr(element, "__clause_element__")
879
880 if is_clause_element:
881 while not isinstance(
882 element, (elements.ClauseElement, schema.SchemaItem, type)
883 ):
884 try:
885 element = element.__clause_element__()
886 except AttributeError:
887 break
888
889 if not is_clause_element:
890 insp = inspection.inspect(element, raiseerr=False)
891 if insp is not None:
892 try:
893 return insp.__clause_element__()
894 except AttributeError:
895 return insp
896
897 # TODO: should we coerce consts None/True/False here?
898 return element
899 else:
900 return element
901
902 def _bound_parameter_getter_func_globals(self, name):
903 """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