MCPcopy
hub / github.com/ormar-orm/ormar / descend

Method descend

ormar/models/excludable.py:147–162  ·  view source on GitHub ↗

Return the flatten sub-map for the nested model reached via ``field``, or ``None`` when there is no sub-map. Callers must check ``is_field_flattened`` first — ``flatten_all`` instances short-circuit there before reaching ``descend``. :param field: relation n

(self, field: str)

Source from the content-addressed store, hash-verified

145 return self._data is not None and self._data.get(field) is Ellipsis
146
147 def descend(self, field: str) -> Optional["FlattenMap"]:
148 """
149 Return the flatten sub-map for the nested model reached via ``field``,
150 or ``None`` when there is no sub-map. Callers must check
151 ``is_field_flattened`` first — ``flatten_all`` instances short-circuit
152 there before reaching ``descend``.
153
154 :param field: relation name to descend into
155 :type field: str
156 :return: nested FlattenMap or None
157 :rtype: Optional[FlattenMap]
158 """
159 value = self._data.get(field) if self._data else None
160 if isinstance(value, dict):
161 return FlattenMap(data=value)
162 return None
163
164 def check_vs_selector(
165 self,

Callers 1

Calls 2

FlattenMapClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected