__init__.pyi 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. from collections.abc import Callable
  2. from typing import Any, Final
  3. from _typeshed import SupportsRead, SupportsWrite
  4. __version__: Final[str]
  5. def encode(
  6. obj: Any,
  7. ensure_ascii: bool = ...,
  8. encode_html_chars: bool = ...,
  9. escape_forward_slashes: bool = ...,
  10. sort_keys: bool = ...,
  11. indent: int = ...,
  12. allow_nan: bool = ...,
  13. reject_bytes: bool = ...,
  14. default: (
  15. Callable[[Any], Any] | None
  16. ) = None, # Specify how to serialize arbitrary types
  17. separators: tuple[str, str] | None = None,
  18. ) -> str: ...
  19. def dumps(
  20. obj: Any,
  21. ensure_ascii: bool = ...,
  22. encode_html_chars: bool = ...,
  23. escape_forward_slashes: bool = ...,
  24. sort_keys: bool = ...,
  25. indent: int = ...,
  26. allow_nan: bool = ...,
  27. reject_bytes: bool = ...,
  28. default: (
  29. Callable[[Any], Any] | None
  30. ) = None, # Specify how to serialize arbitrary types
  31. separators: tuple[str, str] | None = None,
  32. ) -> str: ...
  33. def dump(
  34. obj: Any,
  35. fp: SupportsWrite[str],
  36. *,
  37. ensure_ascii: bool = ...,
  38. encode_html_chars: bool = ...,
  39. escape_forward_slashes: bool = ...,
  40. sort_keys: bool = ...,
  41. indent: int = ...,
  42. allow_nan: bool = ...,
  43. reject_bytes: bool = ...,
  44. default: (
  45. Callable[[Any], Any] | None
  46. ) = None, # Specify how to serialize arbitrary types
  47. separators: tuple[str, str] | None = None,
  48. ) -> None: ...
  49. def decode(s: str | bytes | bytearray) -> Any: ...
  50. def loads(s: str | bytes | bytearray) -> Any: ...
  51. def load(fp: SupportsRead[str | bytes | bytearray]) -> Any: ...
  52. class JSONDecodeError(ValueError): ...