MCPcopy
hub / github.com/pydantic/pydantic / _coerce_items

Method _coerce_items

pydantic/v1/utils.py:602–613  ·  view source on GitHub ↗
(items: Union['AbstractSetIntStr', 'MappingIntStrAny'])

Source from the content-addressed store, hash-verified

600
601 @staticmethod
602 def _coerce_items(items: Union['AbstractSetIntStr', 'MappingIntStrAny']) -> 'MappingIntStrAny':
603 if isinstance(items, Mapping):
604 pass
605 elif isinstance(items, AbstractSet):
606 items = dict.fromkeys(items, ...)
607 else:
608 class_name = getattr(items, '__class__', '???')
609 assert_never(
610 items,
611 f'Unexpected type of exclude value {class_name}',
612 )
613 return items
614
615 @classmethod
616 def _coerce_value(cls, value: Any) -> Any:

Callers 2

__init__Method · 0.95
_coerce_valueMethod · 0.45

Calls 1

assert_neverFunction · 0.85

Tested by

no test coverage detected