Returns the model properties as a dict
(self, serialize=False)
| 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""" |