Coverage for src/hush_hush/_generated/models/audit_actor_option.py: 54%

37 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="AuditActorOption") 

12 

13 

14@_attrs_define 

15class AuditActorOption: 

16 """ 

17 Example: 

18 {'value': 'a1b2c3d4e5f6a7b8', 'label': 'token:a1b2c3d4e5f6a7b8'} 

19 

20 Attributes: 

21 value (str): What to send back as the `actor` query parameter to select this actor. 

22 label (str): What to show the user - "admin", "token:<id>" for a write token, 

23 "consumer-token:<id>" for a consumer token, or "none" for an 

24 unauthenticated read. 

25 """ 

26 

27 value: str 

28 label: str 

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

30 

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

32 value = self.value 

33 

34 label = self.label 

35 

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

37 field_dict.update(self.additional_properties) 

38 field_dict.update( 

39 { 

40 "value": value, 

41 "label": label, 

42 } 

43 ) 

44 

45 return field_dict 

46 

47 @classmethod 

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

49 d = dict(src_dict) 

50 value = d.pop("value") 

51 

52 label = d.pop("label") 

53 

54 audit_actor_option = cls( 

55 value=value, 

56 label=label, 

57 ) 

58 

59 audit_actor_option.additional_properties = d 

60 return audit_actor_option 

61 

62 @property 

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

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

65 

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

67 return self.additional_properties[key] 

68 

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

70 self.additional_properties[key] = value 

71 

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

73 del self.additional_properties[key] 

74 

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

76 return key in self.additional_properties