Format: application/octet-stream
⬇ Download File (3.1 KB)
   1  from _typeshed import SupportsRead
   2  from typing import IO, Any, Callable, Dict, List, Optional, Text, Tuple, Type, Union
   3  
   4  def dumps(
   5      obj: Any,
   6      skipkeys: bool = ...,
   7      ensure_ascii: bool = ...,
   8      check_circular: bool = ...,
   9      allow_nan: bool = ...,
  10      cls: Optional[Type[JSONEncoder]] = ...,
  11      indent: Optional[int] = ...,
  12      separators: Optional[Tuple[str, str]] = ...,
  13      encoding: str = ...,
  14      default: Optional[Callable[[Any], Any]] = ...,
  15      sort_keys: bool = ...,
  16      **kwds: Any,
  17  ) -> str: ...
  18  def dump(
  19      obj: Any,
  20      fp: Union[IO[str], IO[Text]],
  21      skipkeys: bool = ...,
  22      ensure_ascii: bool = ...,
  23      check_circular: bool = ...,
  24      allow_nan: bool = ...,
  25      cls: Optional[Type[JSONEncoder]] = ...,
  26      indent: Optional[int] = ...,
  27      separators: Optional[Tuple[str, str]] = ...,
  28      encoding: str = ...,
  29      default: Optional[Callable[[Any], Any]] = ...,
  30      sort_keys: bool = ...,
  31      **kwds: Any,
  32  ) -> None: ...
  33  def loads(
  34      s: Union[Text, bytes],
  35      encoding: Any = ...,
  36      cls: Optional[Type[JSONDecoder]] = ...,
  37      object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
  38      parse_float: Optional[Callable[[str], Any]] = ...,
  39      parse_int: Optional[Callable[[str], Any]] = ...,
  40      parse_constant: Optional[Callable[[str], Any]] = ...,
  41      object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ...,
  42      **kwds: Any,
  43  ) -> Any: ...
  44  def load(
  45      fp: SupportsRead[Union[Text, bytes]],
  46      encoding: Optional[str] = ...,
  47      cls: Optional[Type[JSONDecoder]] = ...,
  48      object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
  49      parse_float: Optional[Callable[[str], Any]] = ...,
  50      parse_int: Optional[Callable[[str], Any]] = ...,
  51      parse_constant: Optional[Callable[[str], Any]] = ...,
  52      object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ...,
  53      **kwds: Any,
  54  ) -> Any: ...
  55  
  56  class JSONDecoder(object):
  57      def __init__(
  58          self,
  59          encoding: Union[Text, bytes] = ...,
  60          object_hook: Callable[..., Any] = ...,
  61          parse_float: Callable[[str], float] = ...,
  62          parse_int: Callable[[str], int] = ...,
  63          parse_constant: Callable[[str], Any] = ...,
  64          strict: bool = ...,
  65          object_pairs_hook: Callable[..., Any] = ...,
  66      ) -> None: ...
  67      def decode(self, s: Union[Text, bytes], _w: Any = ...) -> Any: ...
  68      def raw_decode(self, s: Union[Text, bytes], idx: int = ...) -> Tuple[Any, Any]: ...
  69  
  70  class JSONEncoder(object):
  71      item_separator: str
  72      key_separator: str
  73      skipkeys: bool
  74      ensure_ascii: bool
  75      check_circular: bool
  76      allow_nan: bool
  77      sort_keys: bool
  78      indent: Optional[int]
  79      def __init__(
  80          self,
  81          skipkeys: bool = ...,
  82          ensure_ascii: bool = ...,
  83          check_circular: bool = ...,
  84          allow_nan: bool = ...,
  85          sort_keys: bool = ...,
  86          indent: Optional[int] = ...,
  87          separators: Tuple[Union[Text, bytes], Union[Text, bytes]] = ...,
  88          encoding: Union[Text, bytes] = ...,
  89          default: Callable[..., Any] = ...,
  90      ) -> None: ...
  91      def default(self, o: Any) -> Any: ...
  92      def encode(self, o: Any) -> str: ...
  93      def iterencode(self, o: Any, _one_shot: bool = ...) -> str: ...
  94