typing.py 1012 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import sys
  2. from typing import Any, AsyncGenerator, Generator, AsyncIterator, Iterator, NewType, Tuple, Union, List, Dict, Type, IO, Optional
  3. try:
  4. from PIL.Image import Image
  5. except ImportError:
  6. class Image:
  7. pass
  8. if sys.version_info >= (3, 8):
  9. from typing import TypedDict
  10. else:
  11. from typing_extensions import TypedDict
  12. from .providers.response import ResponseType
  13. SHA256 = NewType('sha_256_hash', str)
  14. CreateResult = Iterator[Union[str, ResponseType]]
  15. AsyncResult = AsyncIterator[Union[str, ResponseType]]
  16. Messages = List[Dict[str, Union[str, List[Dict[str, Union[str, Dict[str, str]]]]]]]
  17. Cookies = Dict[str, str]
  18. ImageType = Union[str, bytes, IO, Image, None]
  19. __all__ = [
  20. 'Any',
  21. 'AsyncGenerator',
  22. 'Generator',
  23. 'AsyncIterator',
  24. 'Iterator'
  25. 'Tuple',
  26. 'Union',
  27. 'List',
  28. 'Dict',
  29. 'Type',
  30. 'IO',
  31. 'Optional',
  32. 'TypedDict',
  33. 'SHA256',
  34. 'CreateResult',
  35. 'AsyncResult',
  36. 'Messages',
  37. 'Cookies',
  38. 'Image',
  39. 'ImageType'
  40. ]