Coverage for src/hush_hush/_generated/models/auth_status.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="AuthStatus") 

12 

13 

14@_attrs_define 

15class AuthStatus: 

16 """ 

17 Attributes: 

18 bootstrapped (bool): Whether an admin account has been created yet. 

19 authenticated (bool): Whether the request carries a valid, unexpired session cookie. 

20 False for no cookie, an expired one or one that doesn't match a 

21 session - still a 200, so a client can ask without being 

22 answered with a 401. 

23 """ 

24 

25 bootstrapped: bool 

26 authenticated: bool 

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

28 

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

30 bootstrapped = self.bootstrapped 

31 

32 authenticated = self.authenticated 

33 

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

35 field_dict.update(self.additional_properties) 

36 field_dict.update( 

37 { 

38 "bootstrapped": bootstrapped, 

39 "authenticated": authenticated, 

40 } 

41 ) 

42 

43 return field_dict 

44 

45 @classmethod 

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

47 d = dict(src_dict) 

48 bootstrapped = d.pop("bootstrapped") 

49 

50 authenticated = d.pop("authenticated") 

51 

52 auth_status = cls( 

53 bootstrapped=bootstrapped, 

54 authenticated=authenticated, 

55 ) 

56 

57 auth_status.additional_properties = d 

58 return auth_status 

59 

60 @property 

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

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

63 

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

65 return self.additional_properties[key] 

66 

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

68 self.additional_properties[key] = value 

69 

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

71 del self.additional_properties[key] 

72 

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

74 return key in self.additional_properties