Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
(
self,
*,
include: Optional[Union['AbstractSetIntStr', 'MappingIntStrAny']] = None,
exclude: Optional[Union['AbstractSetIntStr', 'MappingIntStrAny']] = None,
by_alias: bool = False,
skip_defaults: Optional[bool] = None,
exclude_unset: bool = False,
exclude_defaults: bool = False,
exclude_none: bool = False,
)
| 448 | object_setattr(self, name, default) |
| 449 | |
| 450 | def dict( |
| 451 | self, |
| 452 | *, |
| 453 | include: Optional[Union['AbstractSetIntStr', 'MappingIntStrAny']] = None, |
| 454 | exclude: Optional[Union['AbstractSetIntStr', 'MappingIntStrAny']] = None, |
| 455 | by_alias: bool = False, |
| 456 | skip_defaults: Optional[bool] = None, |
| 457 | exclude_unset: bool = False, |
| 458 | exclude_defaults: bool = False, |
| 459 | exclude_none: bool = False, |
| 460 | ) -> 'DictStrAny': |
| 461 | """ |
| 462 | Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. |
| 463 | |
| 464 | """ |
| 465 | if skip_defaults is not None: |
| 466 | warnings.warn( |
| 467 | f'{self.__class__.__name__}.dict(): "skip_defaults" is deprecated and replaced by "exclude_unset"', |
| 468 | DeprecationWarning, |
| 469 | ) |
| 470 | exclude_unset = skip_defaults |
| 471 | |
| 472 | return dict( |
| 473 | self._iter( |
| 474 | to_dict=True, |
| 475 | by_alias=by_alias, |
| 476 | include=include, |
| 477 | exclude=exclude, |
| 478 | exclude_unset=exclude_unset, |
| 479 | exclude_defaults=exclude_defaults, |
| 480 | exclude_none=exclude_none, |
| 481 | ) |
| 482 | ) |
| 483 | |
| 484 | def json( |
| 485 | self, |
no test coverage detected