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

Method from_excludable

ormar/models/excludable.py:345–358  ·  view source on GitHub ↗

Copy passed ExcludableItems to avoid inplace modifications. :param other: other excludable items to be copied :type other: ormar.models.excludable.ExcludableItems :return: copy of other :rtype: ormar.models.excludable.ExcludableItems

(cls, other: "ExcludableItems")

Source from the content-addressed store, hash-verified

343
344 @classmethod
345 def from_excludable(cls, other: "ExcludableItems") -> "ExcludableItems":
346 """
347 Copy passed ExcludableItems to avoid inplace modifications.
348
349 :param other: other excludable items to be copied
350 :type other: ormar.models.excludable.ExcludableItems
351 :return: copy of other
352 :rtype: ormar.models.excludable.ExcludableItems
353 """
354 new_excludable = cls()
355 for key, value in other.items.items():
356 new_excludable.items[key] = value.get_copy()
357 new_excludable._flatten_paths = set(other._flatten_paths)
358 return new_excludable
359
360 def include_entry_count(self) -> int:
361 """

Callers 4

flatten_fieldsMethod · 0.80
fieldsMethod · 0.80

Calls 1

get_copyMethod · 0.80