Coverage for src/hush_hush/_generated/models/used_by.py: 56%

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, cast 

7 

8from attrs import define as _attrs_define 

9from attrs import field as _attrs_field 

10 

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

12 

13 

14@_attrs_define 

15class UsedBy: 

16 """ 

17 Attributes: 

18 used_by (list[str]): The consumers (repos or hosts) recorded as depending on this 

19 object. Set at creation, and replaceable later via 

20 UpdateObjectRequest's own used_by field - a plain value update 

21 that omits it leaves the list as it was. 

22 A consumer named more than once is recorded once. 

23 """ 

24 

25 used_by: list[str] 

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

27 

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

29 used_by = self.used_by 

30 

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

32 field_dict.update(self.additional_properties) 

33 field_dict.update( 

34 { 

35 "used_by": used_by, 

36 } 

37 ) 

38 

39 return field_dict 

40 

41 @classmethod 

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

43 d = dict(src_dict) 

44 used_by = cast(list[str], d.pop("used_by")) 

45 

46 used_by = cls( 

47 used_by=used_by, 

48 ) 

49 

50 used_by.additional_properties = d 

51 return used_by 

52 

53 @property 

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

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

56 

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

58 return self.additional_properties[key] 

59 

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

61 self.additional_properties[key] = value 

62 

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

64 del self.additional_properties[key] 

65 

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

67 return key in self.additional_properties