MCPcopy Create free account
hub / github.com/ceph/ceph / from_json

Method from_json

src/python-common/ceph/deployment/service_spec.py:132–141  ·  view source on GitHub ↗
(cls, data: Union[dict, str])

Source from the content-addressed store, hash-verified

130 @classmethod
131 @handle_type_error
132 def from_json(cls, data: Union[dict, str]) -> 'HostPlacementSpec':
133 if isinstance(data, str):
134 return cls.parse(data)
135 if isinstance(data, dict):
136 return cls(
137 normalize_hostname(data.get('hostname', '')),
138 data.get('network', ''),
139 data.get('name', '')
140 )
141 return cls(**data)
142
143 def to_json(self) -> str:
144 return str(self)

Callers

nothing calls this directly

Calls 3

normalize_hostnameFunction · 0.90
parseMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected