massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stubs / PyMySQL / pymysql / connections.pyi
1 from socket import socket as _socket
2 from typing import Any, AnyStr, Generic, Mapping, Tuple, Type, TypeVar, overload
3
4 from .charset import charset_by_id as charset_by_id, charset_by_name as charset_by_name
5 from .constants import CLIENT as CLIENT, COMMAND as COMMAND, FIELD_TYPE as FIELD_TYPE, SERVER_STATUS as SERVER_STATUS
6 from .cursors import Cursor
7 from .util import byte2int as byte2int, int2byte as int2byte
8
9 SSL_ENABLED: Any
10 DEFAULT_USER: Any
11 DEBUG: Any
12 DEFAULT_CHARSET: Any
13
14 _C = TypeVar("_C", bound=Cursor)
15 _C2 = TypeVar("_C2", bound=Cursor)
16
17 def dump_packet(data): ...
18 def pack_int24(n): ...
19 def lenenc_int(i: int) -> bytes: ...
20
21 class MysqlPacket:
22     connection: Any
23     def __init__(self, data, encoding): ...
24     def get_all_data(self): ...
25     def read(self, size): ...
26     def read_all(self): ...
27     def advance(self, length): ...
28     def rewind(self, position: int = ...): ...
29     def get_bytes(self, position, length: int = ...): ...
30     def read_string(self) -> bytes: ...
31     def read_uint8(self) -> Any: ...
32     def read_uint16(self) -> Any: ...
33     def read_uint24(self) -> Any: ...
34     def read_uint32(self) -> Any: ...
35     def read_uint64(self) -> Any: ...
36     def read_length_encoded_integer(self) -> int: ...
37     def read_length_coded_string(self) -> bytes: ...
38     def read_struct(self, fmt: str) -> Tuple[Any, ...]: ...
39     def is_ok_packet(self) -> bool: ...
40     def is_eof_packet(self) -> bool: ...
41     def is_auth_switch_request(self) -> bool: ...
42     def is_extra_auth_data(self) -> bool: ...
43     def is_resultset_packet(self) -> bool: ...
44     def is_load_local_packet(self) -> bool: ...
45     def is_error_packet(self) -> bool: ...
46     def check_error(self): ...
47     def raise_for_error(self) -> None: ...
48     def dump(self): ...
49
50 class FieldDescriptorPacket(MysqlPacket):
51     def __init__(self, data, encoding): ...
52     def description(self): ...
53     def get_column_length(self): ...
54
55 class Connection(Generic[_C]):
56     ssl: Any
57     host: Any
58     port: Any
59     user: Any
60     password: Any
61     db: Any
62     unix_socket: Any
63     bind_address: Any
64     charset: Any
65     use_unicode: Any
66     client_flag: Any
67     cursorclass: Any
68     connect_timeout: Any
69     messages: Any
70     encoders: Any
71     decoders: Any
72     host_info: Any
73     sql_mode: Any
74     init_command: Any
75     max_allowed_packet: int
76     server_public_key: bytes
77     @overload
78     def __init__(
79         self: Connection[Cursor],  # different between overloads
80         *,
81         host: str | None = ...,
82         user: Any | None = ...,
83         password: str = ...,
84         database: Any | None = ...,
85         port: int = ...,
86         unix_socket: Any | None = ...,
87         charset: str = ...,
88         sql_mode: Any | None = ...,
89         read_default_file: Any | None = ...,
90         conv=...,
91         use_unicode: bool | None = ...,
92         client_flag: int = ...,
93         cursorclass: None = ...,  # different between overloads
94         init_command: Any | None = ...,
95         connect_timeout: int | None = ...,
96         ssl: Mapping[Any, Any] | None = ...,
97         ssl_ca=...,
98         ssl_cert=...,
99         ssl_disabled=...,
100         ssl_key=...,
101         ssl_verify_cert=...,
102         ssl_verify_identity=...,
103         read_default_group: Any | None = ...,
104         compress: Any | None = ...,
105         named_pipe: Any | None = ...,
106         autocommit: bool | None = ...,
107         db: Any | None = ...,
108         passwd: Any | None = ...,
109         local_infile: Any | None = ...,
110         max_allowed_packet: int = ...,
111         defer_connect: bool | None = ...,
112         auth_plugin_map: Mapping[Any, Any] | None = ...,
113         read_timeout: float | None = ...,
114         write_timeout: float | None = ...,
115         bind_address: Any | None = ...,
116         binary_prefix: bool | None = ...,
117         program_name: Any | None = ...,
118         server_public_key: bytes | None = ...,
119     ): ...
120     @overload
121     def __init__(
122         self: Connection[_C],  # different between overloads
123         *,
124         host: str | None = ...,
125         user: Any | None = ...,
126         password: str = ...,
127         database: Any | None = ...,
128         port: int = ...,
129         unix_socket: Any | None = ...,
130         charset: str = ...,
131         sql_mode: Any | None = ...,
132         read_default_file: Any | None = ...,
133         conv=...,
134         use_unicode: bool | None = ...,
135         client_flag: int = ...,
136         cursorclass: Type[_C] = ...,  # different between overloads
137         init_command: Any | None = ...,
138         connect_timeout: int | None = ...,
139         ssl: Mapping[Any, Any] | None = ...,
140         ssl_ca=...,
141         ssl_cert=...,
142         ssl_disabled=...,
143         ssl_key=...,
144         ssl_verify_cert=...,
145         ssl_verify_identity=...,
146         read_default_group: Any | None = ...,
147         compress: Any | None = ...,
148         named_pipe: Any | None = ...,
149         autocommit: bool | None = ...,
150         db: Any | None = ...,
151         passwd: Any | None = ...,
152         local_infile: Any | None = ...,
153         max_allowed_packet: int = ...,
154         defer_connect: bool | None = ...,
155         auth_plugin_map: Mapping[Any, Any] | None = ...,
156         read_timeout: float | None = ...,
157         write_timeout: float | None = ...,
158         bind_address: Any | None = ...,
159         binary_prefix: bool | None = ...,
160         program_name: Any | None = ...,
161         server_public_key: bytes | None = ...,
162     ): ...
163     socket: Any
164     rfile: Any
165     wfile: Any
166     def close(self) -> None: ...
167     @property
168     def open(self) -> bool: ...
169     def autocommit(self, value) -> None: ...
170     def get_autocommit(self) -> bool: ...
171     def commit(self) -> None: ...
172     def begin(self) -> None: ...
173     def rollback(self) -> None: ...
174     def select_db(self, db) -> None: ...
175     def escape(self, obj, mapping: Mapping[Any, Any] | None = ...): ...
176     def literal(self, obj): ...
177     def escape_string(self, s: AnyStr) -> AnyStr: ...
178     @overload
179     def cursor(self, cursor: None = ...) -> _C: ...
180     @overload
181     def cursor(self, cursor: Type[_C2]) -> _C2: ...
182     def query(self, sql, unbuffered: bool = ...) -> int: ...
183     def next_result(self, unbuffered: bool = ...) -> int: ...
184     def affected_rows(self): ...
185     def kill(self, thread_id): ...
186     def ping(self, reconnect: bool = ...) -> None: ...
187     def set_charset(self, charset) -> None: ...
188     def connect(self, sock: _socket | None = ...) -> None: ...
189     def write_packet(self, payload) -> None: ...
190     def _read_packet(self, packet_type=...): ...
191     def insert_id(self): ...
192     def thread_id(self): ...
193     def character_set_name(self): ...
194     def get_host_info(self): ...
195     def get_proto_info(self): ...
196     def get_server_info(self): ...
197     def show_warnings(self): ...
198     Warning: Any
199     Error: Any
200     InterfaceError: Any
201     DatabaseError: Any
202     DataError: Any
203     OperationalError: Any
204     IntegrityError: Any
205     InternalError: Any
206     ProgrammingError: Any
207     NotSupportedError: Any
208
209 class MySQLResult:
210     connection: Any
211     affected_rows: Any
212     insert_id: Any
213     server_status: Any
214     warning_count: Any
215     message: Any
216     field_count: Any
217     description: Any
218     rows: Any
219     has_next: Any
220     def __init__(self, connection: Connection[Any]) -> None: ...
221     first_packet: Any
222     def read(self) -> None: ...
223     def init_unbuffered_query(self) -> None: ...
224
225 class LoadLocalFile:
226     filename: Any
227     connection: Connection[Any]
228     def __init__(self, filename: Any, connection: Connection[Any]) -> None: ...
229     def send_data(self) -> None: ...