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

Function convert_all

ormar/models/excludable.py:42–54  ·  view source on GitHub ↗

Convert pydantic ``__all__`` special index into the ormar form, which does not support index-based exclusions. :param items: current include/exclude value :type items: Union[set, dict, None] :return: items with ``__all__`` unwrapped if present :rtype: Union[set, dict, None]

(items: Union[set, dict, None])

Source from the content-addressed store, hash-verified

40
41
42def convert_all(items: Union[set, dict, None]) -> Union[set, dict, None]:
43 """
44 Convert pydantic ``__all__`` special index into the ormar form, which does
45 not support index-based exclusions.
46
47 :param items: current include/exclude value
48 :type items: Union[set, dict, None]
49 :return: items with ``__all__`` unwrapped if present
50 :rtype: Union[set, dict, None]
51 """
52 if isinstance(items, dict) and "__all__" in items:
53 return items.get("__all__")
54 return items
55
56
57def normalize_to_dict(items: Union[set, dict, None]) -> Optional[dict]:

Callers 1

Calls 1

getMethod · 0.45

Tested by

no test coverage detected