Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

72 строки
1.7 KiB

  1. from collections.abc import Mapping
  2. from typing import Any, TypeVar, Union
  3. from attrs import define as _attrs_define
  4. from attrs import field as _attrs_field
  5. from app_types import UNSET, Unset
  6. T = TypeVar("T", bound="SettingItem")
  7. @_attrs_define
  8. class SettingItem:
  9. """General setting of the app
  10. Attributes:
  11. id (str):
  12. debug (Union[Unset, str]): Debug mode
  13. """
  14. id: str
  15. debug: Union[Unset, str] = UNSET
  16. additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
  17. def to_dict(self) -> dict[str, Any]:
  18. id = self.id
  19. debug = self.debug
  20. field_dict: dict[str, Any] = {}
  21. field_dict.update(self.additional_properties)
  22. field_dict.update(
  23. {
  24. "id": id,
  25. }
  26. )
  27. if debug is not UNSET:
  28. field_dict["debug"] = debug
  29. return field_dict
  30. @classmethod
  31. def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
  32. d = dict(src_dict)
  33. id = d.pop("id")
  34. debug = d.pop("debug", UNSET)
  35. setting_item = cls(
  36. id=id,
  37. debug=debug,
  38. )
  39. setting_item.additional_properties = d
  40. return setting_item
  41. @property
  42. def additional_keys(self) -> list[str]:
  43. return list(self.additional_properties.keys())
  44. def __getitem__(self, key: str) -> Any:
  45. return self.additional_properties[key]
  46. def __setitem__(self, key: str, value: Any) -> None:
  47. self.additional_properties[key] = value
  48. def __delitem__(self, key: str) -> None:
  49. del self.additional_properties[key]
  50. def __contains__(self, key: str) -> bool:
  51. return key in self.additional_properties