Coverage for src/hush_hush/_generated/types.py: 92%

26 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 

3"""Contains some shared types for properties""" 

4 

5from collections.abc import Mapping, MutableMapping 

6from http import HTTPStatus 

7from typing import IO, BinaryIO, Generic, Literal, TypeVar 

8 

9from attrs import define 

10 

11 

12class Unset: 

13 def __bool__(self) -> Literal[False]: 

14 return False 

15 

16 

17UNSET: Unset = Unset() 

18 

19# The types that `httpx.Client(files=)` can accept, copied from that library. 

20FileContent = IO[bytes] | bytes | str 

21FileTypes = ( 

22 # (filename, file (or bytes), content_type) 

23 tuple[str | None, FileContent, str | None] 

24 # (filename, file (or bytes), content_type, headers) 

25 | tuple[str | None, FileContent, str | None, Mapping[str, str]] 

26) 

27RequestFiles = list[tuple[str, FileTypes]] 

28 

29 

30@define 

31class File: 

32 """Contains information for file uploads""" 

33 

34 payload: BinaryIO 

35 file_name: str | None = None 

36 mime_type: str | None = None 

37 

38 def to_tuple(self) -> FileTypes: 

39 """Return a tuple representation that httpx will accept for multipart/form-data""" 

40 return self.file_name, self.payload, self.mime_type 

41 

42 

43T = TypeVar("T") 

44 

45 

46@define 

47class Response(Generic[T]): 

48 """A response from an endpoint""" 

49 

50 status_code: HTTPStatus 

51 content: bytes 

52 headers: MutableMapping[str, str] 

53 parsed: T | None 

54 

55 

56__all__ = ["UNSET", "File", "FileTypes", "RequestFiles", "Response", "Unset"]