Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

62 lignes
1.4 KiB

  1. from collections.abc import Mapping
  2. from typing import Any, TypeVar
  3. from uuid import UUID
  4. from attrs import define as _attrs_define
  5. from attrs import field as _attrs_field
  6. T = TypeVar("T", bound="RemoveItem")
  7. @_attrs_define
  8. class RemoveItem:
  9. """Item to be removed
  10. Attributes:
  11. id (UUID):
  12. """
  13. id: UUID
  14. additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
  15. def to_dict(self) -> dict[str, Any]:
  16. id = str(self.id)
  17. field_dict: dict[str, Any] = {}
  18. field_dict.update(self.additional_properties)
  19. field_dict.update(
  20. {
  21. "id": id,
  22. }
  23. )
  24. return field_dict
  25. @classmethod
  26. def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
  27. d = dict(src_dict)
  28. id = UUID(d.pop("id"))
  29. remove_item = cls(
  30. id=id,
  31. )
  32. remove_item.additional_properties = d
  33. return remove_item
  34. @property
  35. def additional_keys(self) -> list[str]:
  36. return list(self.additional_properties.keys())
  37. def __getitem__(self, key: str) -> Any:
  38. return self.additional_properties[key]
  39. def __setitem__(self, key: str, value: Any) -> None:
  40. self.additional_properties[key] = value
  41. def __delitem__(self, key: str) -> None:
  42. del self.additional_properties[key]
  43. def __contains__(self, key: str) -> bool:
  44. return key in self.additional_properties