Coverage for src/hush_hush/_generated/models/error.py: 71%

34 statements  

« prev     ^ index     » next       coverage.py v7.16.0, created at 2026-10-16 16:01 +0000

1# Code generated by openapi-python-client from hush-hush/api/openapi.yaml; DO NOT EDIT. 

2 

3from __future__ import annotations 

4 

5from collections.abc import Mapping 

6from typing import Any, TypeVar 

7 

8from attrs import define as _attrs_define 

9from attrs import field as _attrs_field 

10 

11T = TypeVar("T", bound="Error") 

12 

13 

14@_attrs_define 

15class Error: 

16 """ 

17 Attributes: 

18 error (str): What went wrong, in terms safe to show a caller. Nothing here 

19 handles authentication with a detail worth holding back. 

20 """ 

21 

22 error: str 

23 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 

24 

25 def to_dict(self) -> dict[str, Any]: 

26 error = self.error 

27 

28 field_dict: dict[str, Any] = {} 

29 field_dict.update(self.additional_properties) 

30 field_dict.update( 

31 { 

32 "error": error, 

33 } 

34 ) 

35 

36 return field_dict 

37 

38 @classmethod 

39 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 

40 d = dict(src_dict) 

41 error = d.pop("error") 

42 

43 error = cls( 

44 error=error, 

45 ) 

46 

47 error.additional_properties = d 

48 return error 

49 

50 @property 

51 def additional_keys(self) -> list[str]: 

52 return list(self.additional_properties.keys()) 

53 

54 def __getitem__(self, key: str) -> Any: 

55 return self.additional_properties[key] 

56 

57 def __setitem__(self, key: str, value: Any) -> None: 

58 self.additional_properties[key] = value 

59 

60 def __delitem__(self, key: str) -> None: 

61 del self.additional_properties[key] 

62 

63 def __contains__(self, key: str) -> bool: 

64 return key in self.additional_properties