MCPcopy Index your code
hub / github.com/kubernetes-client/python / to_dict

Method to_dict

kubernetes/client/models/v1_taint.py:167–197  ·  view source on GitHub ↗

Returns the model properties as a dict

(self, serialize=False)

Source from the content-addressed store, hash-verified

165 self._value = value
166
167 def to_dict(self, serialize=False):
168 """Returns the model properties as a dict"""
169 result = {}
170
171 def convert(x):
172 if hasattr(x, "to_dict"):
173 args = getfullargspec(x.to_dict).args
174 if len(args) == 1:
175 return x.to_dict()
176 else:
177 return x.to_dict(serialize)
178 else:
179 return x
180
181 for attr, _ in six.iteritems(self.openapi_types):
182 value = getattr(self, attr)
183 attr = self.attribute_map.get(attr, attr) if serialize else attr
184 if isinstance(value, list):
185 result[attr] = list(map(
186 lambda x: convert(x),
187 value
188 ))
189 elif isinstance(value, dict):
190 result[attr] = dict(map(
191 lambda item: (item[0], convert(item[1])),
192 value.items()
193 ))
194 else:
195 result[attr] = convert(value)
196
197 return result
198
199 def to_str(self):
200 """Returns the string representation of the model"""

Callers 4

to_strMethod · 0.95
__eq__Method · 0.95
__ne__Method · 0.95
convertMethod · 0.45

Calls 2

getMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected