File: pickle.pyi

package info (click to toggle)
mypy 0.470-complete-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,864 kB
  • ctags: 3,264
  • sloc: python: 21,838; makefile: 18
file content (67 lines) | stat: -rw-r--r-- 1,807 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Stubs for pickle

from typing import Any, IO, Union, Tuple, Callable, Optional, Iterator
# Imports used in type comments only.
from typing import Mapping  # noqa

HIGHEST_PROTOCOL = ...  # type: int
DEFAULT_PROTOCOL = ...  # type: int


def dump(obj: Any, file: IO[bytes], protocol: int = None, *,
         fix_imports: bool = ...) -> None: ...


def dumps(obj: Any, protocol: int = ..., *,
          fix_imports: bool = ...) -> bytes: ...


def loads(bytes_object: bytes, *, fix_imports: bool = ...,
          encoding: str = ..., errors: str = ...) -> Any: ...


def load(file: IO[bytes], *, fix_imports: bool = ..., encoding: str = ...,
         errors: str = ...) -> Any: ...


class PickleError(Exception):
    pass


class PicklingError(PickleError):
    pass


class UnpicklingError(PickleError):
    pass


_reducedtype = Union[str,
                     Tuple[Callable[..., Any], Tuple],
                     Tuple[Callable[..., Any], Tuple, Any],
                     Tuple[Callable[..., Any], Tuple, Any,
                           Optional[Iterator]],
                     Tuple[Callable[..., Any], Tuple, Any,
                           Optional[Iterator], Optional[Iterator]]]


class Pickler:
    dispatch_table = ...  # type: Mapping[type, Callable[[Any], _reducedtype]]

    def __init__(self, file: IO[bytes], protocol: int = None, *,
                 fix_imports: bool = ...) -> None: ...

    def dump(self, obj: Any) -> None: ...

    def persistent_id(self, obj: Any) -> Any: ...


class Unpickler:
    def __init__(self, file: IO[bytes], *, fix_imports: bool = ...,
                 encoding: str = ..., errors: str = ...) -> None: ...

    def load(self) -> Any: ...

    def persistent_load(self, pid: Any) -> Any: ...

    def find_class(self, module: str, name: str) -> Any: ...