MCPcopy
hub / github.com/danielgtaylor/python-betterproto / from_dict

Method from_dict

src/betterproto/__init__.py:1595–1611  ·  view source on GitHub ↗

Parse the key/value pairs into the a new message instance. Parameters ----------- value: Dict[:class:`str`, Any] The dictionary to parse from. Returns -------- :class:`Message` The initialized message.

(cls: type[Self], value: Mapping[str, Any])

Source from the content-addressed store, hash-verified

1593
1594 @hybridmethod
1595 def from_dict(cls: type[Self], value: Mapping[str, Any]) -> Self: # type: ignore
1596 """
1597 Parse the key/value pairs into the a new message instance.
1598
1599 Parameters
1600 -----------
1601 value: Dict[:class:`str`, Any]
1602 The dictionary to parse from.
1603
1604 Returns
1605 --------
1606 :class:`Message`
1607 The initialized message.
1608 """
1609 self = cls(**cls._from_dict_init(value))
1610 self._serialized_on_wire = True
1611 return self
1612
1613 @from_dict.instancemethod
1614 def from_dict(self, value: Mapping[str, Any]) -> Self:

Callers 15

from_jsonMethod · 0.95
_from_dict_initMethod · 0.45
test_streams.pyFile · 0.45
test_struct_roundtripFunction · 0.45
test_enum_as_int_jsonFunction · 0.45
test_json_casingFunction · 0.45
test_dict_casingFunction · 0.45
test_iso_datetimeFunction · 0.45

Calls 1

_from_dict_initMethod · 0.95

Tested by 12

test_struct_roundtripFunction · 0.36
test_enum_as_int_jsonFunction · 0.36
test_json_casingFunction · 0.36
test_dict_casingFunction · 0.36
test_iso_datetimeFunction · 0.36
test_iso_datetime_listFunction · 0.36