typing.py 1019 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. from typing import Type as Image
  7. if sys.version_info >= (3, 8):
  8. from typing import TypedDict
  9. else:
  10. from typing_extensions import TypedDict
  11. from .providers.response import ResponseType
  12. SHA256 = NewType('sha_256_hash', str)
  13. CreateResult = Iterator[Union[str, ResponseType]]
  14. AsyncResult = AsyncIterator[Union[str, ResponseType]]
  15. Messages = List[Dict[str, Union[str, List[Dict[str, Union[str, Dict[str, str]]]]]]]
  16. Cookies = Dict[str, str]
  17. ImageType = Union[str, bytes, IO, Image, None]
  18. __all__ = [
  19. 'Any',
  20. 'AsyncGenerator',
  21. 'Generator',
  22. 'AsyncIterator',
  23. 'Iterator'
  24. 'Tuple',
  25. 'Union',
  26. 'List',
  27. 'Dict',
  28. 'Type',
  29. 'IO',
  30. 'Optional',
  31. 'TypedDict',
  32. 'SHA256',
  33. 'CreateResult',
  34. 'AsyncResult',
  35. 'Messages',
  36. 'Cookies',
  37. 'Image',
  38. 'ImageType'
  39. ]