MCPcopy
hub / github.com/django/django / __init__

Method __init__

django/contrib/postgres/fields/array.py:255–270  ·  view source on GitHub ↗
(self, lhs, rhs)

Source from the content-addressed store, hash-verified

253
254class ArrayRHSMixin:
255 def __init__(self, lhs, rhs):
256 # Don't wrap arrays that contains only None values, psycopg doesn't
257 # allow this.
258 if isinstance(rhs, (tuple, list)) and any(self._rhs_not_none_values(rhs)):
259 expressions = []
260 for value in rhs:
261 if not hasattr(value, "resolve_expression"):
262 field = lhs.output_field
263 value = Value(field.base_field.get_prep_value(value))
264 expressions.append(value)
265 rhs = Func(
266 *expressions,
267 function="ARRAY",
268 template="%(function)s[%(expressions)s]",
269 )
270 super().__init__(lhs, rhs)
271
272 def process_rhs(self, compiler, connection):
273 rhs, rhs_params = super().process_rhs(compiler, connection)

Callers

nothing calls this directly

Calls 6

_rhs_not_none_valuesMethod · 0.95
ValueClass · 0.90
FuncClass · 0.90
get_prep_valueMethod · 0.45
appendMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected