typing.py 875 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. SHA256 = NewType('sha_256_hash', str)
  12. CreateResult = Iterator[str]
  13. AsyncResult = AsyncIterator[str]
  14. Messages = List[Dict[str, str]]
  15. Cookies = Dict[str, str]
  16. ImageType = Union[str, bytes, IO, Image, None]
  17. __all__ = [
  18. 'Any',
  19. 'AsyncGenerator',
  20. 'Generator',
  21. 'AsyncIterator',
  22. 'Iterator'
  23. 'Tuple',
  24. 'Union',
  25. 'List',
  26. 'Dict',
  27. 'Type',
  28. 'IO',
  29. 'Optional',
  30. 'TypedDict',
  31. 'SHA256',
  32. 'CreateResult',
  33. 'AsyncResult',
  34. 'Messages',
  35. 'Cookies',
  36. 'Image',
  37. 'ImageType'
  38. ]