massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / coc-python-data / languageServer.0.5.59 / Typeshed / stdlib / 2and3 / zipfile.pyi
1 # Stubs for zipfile\r
2 \r
3 from typing import Callable, IO, Iterable, List, Optional, Text, Tuple, Type, Union\r
4 from types import TracebackType\r
5 import os\r
6 import sys\r
7 \r
8 \r
9 if sys.version_info >= (3, 6):\r
10     _Path = Union[os.PathLike[Text], Text]\r
11 else:\r
12     _Path = Text\r
13 _SZI = Union[Text, ZipInfo]\r
14 _DT = Tuple[int, int, int, int, int, int]\r
15 \r
16 \r
17 if sys.version_info >= (3,):\r
18     class BadZipFile(Exception): ...\r
19     BadZipfile = BadZipFile\r
20 else:\r
21     class BadZipfile(Exception): ...\r
22 error = BadZipfile\r
23 \r
24 class LargeZipFile(Exception): ...\r
25 \r
26 class ZipFile:\r
27     debug = ...  # type: int\r
28     comment = ...  # type: bytes\r
29     filelist = ...  # type: List[ZipInfo]\r
30     def __init__(self, file: Union[_Path, IO[bytes]], mode: Text = ..., compression: int = ...,\r
31                  allowZip64: bool = ...) -> None: ...\r
32     def __enter__(self) -> ZipFile: ...\r
33     def __exit__(self, exc_type: Optional[Type[BaseException]],\r
34                  exc_val: Optional[BaseException],\r
35                  exc_tb: Optional[TracebackType]) -> bool: ...\r
36     def close(self) -> None: ...\r
37     def getinfo(self, name: Text) -> ZipInfo: ...\r
38     def infolist(self) -> List[ZipInfo]: ...\r
39     def namelist(self) -> List[Text]: ...\r
40     def open(self, name: _SZI, mode: Text = ...,\r
41              pwd: Optional[bytes] = ...) -> IO[bytes]: ...\r
42     def extract(self, member: _SZI, path: Optional[_SZI] = ...,\r
43                 pwd: bytes = ...) -> str: ...\r
44     def extractall(self, path: Optional[_Path] = ...,\r
45                    members: Optional[Iterable[Text]] = ...,\r
46                    pwd: Optional[bytes] = ...) -> None: ...\r
47     def printdir(self) -> None: ...\r
48     def setpassword(self, pwd: bytes) -> None: ...\r
49     def read(self, name: _SZI, pwd: Optional[bytes] = ...) -> bytes: ...\r
50     def testzip(self) -> Optional[str]: ...\r
51     def write(self, filename: _Path, arcname: Optional[_Path] = ...,\r
52               compress_type: Optional[int] = ...) -> None: ...\r
53     if sys.version_info >= (3,):\r
54         def writestr(self, zinfo_or_arcname: _SZI, data: Union[bytes, str],\r
55                      compress_type: Optional[int] = ...) -> None: ...\r
56     else:\r
57         def writestr(self,\r
58                      zinfo_or_arcname: _SZI, bytes: bytes,\r
59                      compress_type: Optional[int] = ...) -> None: ...\r
60 \r
61 class PyZipFile(ZipFile):\r
62     if sys.version_info >= (3,):\r
63         def __init__(self, file: Union[str, IO[bytes]], mode: str = ...,\r
64                      compression: int = ..., allowZip64: bool = ...,\r
65                      opimize: int = ...) -> None: ...\r
66         def writepy(self, pathname: str, basename: str = ...,\r
67                     filterfunc: Optional[Callable[[str], bool]] = ...) -> None: ...\r
68     else:\r
69         def writepy(self,\r
70                     pathname: Text, basename: Text = ...) -> None: ...\r
71 \r
72 class ZipInfo:\r
73     filename = ...  # type: Text\r
74     date_time = ...  # type: _DT\r
75     compress_type = ...  # type: int\r
76     comment = ...  # type: bytes\r
77     extra = ...  # type: bytes\r
78     create_system = ...  # type: int\r
79     create_version = ...  # type: int\r
80     extract_version = ...  # type: int\r
81     reserved = ...  # type: int\r
82     flag_bits = ...  # type: int\r
83     volume = ...  # type: int\r
84     internal_attr = ...  # type: int\r
85     external_attr = ...  # type: int\r
86     header_offset = ...  # type: int\r
87     CRC = ...  # type: int\r
88     compress_size = ...  # type: int\r
89     file_size = ...  # type: int\r
90     if sys.version_info < (3,):\r
91         def __init__(self, filename: Optional[Text] = ...,\r
92                      date_time: Optional[_DT] = ...) -> None: ...\r
93 \r
94 \r
95 def is_zipfile(filename: Union[Text, IO[bytes]]) -> bool: ...\r
96 \r
97 ZIP_STORED = ...  # type: int\r
98 ZIP_DEFLATED = ...  # type: int\r
99 if sys.version_info >= (3, 3):\r
100     ZIP_BZIP2 = ...  # type: int\r
101     ZIP_LZMA = ...  # type: int\r