from typing import Any, Optional, Type
from .charset import MBLENGTH as MBLENGTH, charset_by_name as charset_by_name, charset_by_id as charset_by_id
from .cursors import Cursor as Cursor
from .constants import FIELD_TYPE as FIELD_TYPE, FLAG as FLAG
from .constants import SERVER_STATUS as SERVER_STATUS
from .constants import CLIENT as CLIENT
from .constants import COMMAND as COMMAND
from .util import join_bytes as join_bytes, byte2int as byte2int, int2byte as int2byte
from .converters import escape_item as escape_item, encoders as encoders, decoders as decoders
from .err import raise_mysql_exception as raise_mysql_exception, Warning as Warning, Error as Error, InterfaceError as InterfaceError, DataError as DataError, DatabaseError as DatabaseError, OperationalError as OperationalError, IntegrityError as IntegrityError, InternalError as InternalError, NotSupportedError as NotSupportedError, ProgrammingError as ProgrammingError

sha_new: Any
SSL_ENABLED: Any
DEFAULT_USER: Any
DEBUG: Any
NULL_COLUMN: Any
UNSIGNED_CHAR_COLUMN: Any
UNSIGNED_SHORT_COLUMN: Any
UNSIGNED_INT24_COLUMN: Any
UNSIGNED_INT64_COLUMN: Any
UNSIGNED_CHAR_LENGTH: Any
UNSIGNED_SHORT_LENGTH: Any
UNSIGNED_INT24_LENGTH: Any
UNSIGNED_INT64_LENGTH: Any
DEFAULT_CHARSET: Any

def dump_packet(data): ...

SCRAMBLE_LENGTH_323: Any

class RandStruct_323:
    max_value: Any
    seed1: Any
    seed2: Any
    def __init__(self, seed1, seed2): ...
    def my_rnd(self): ...

def pack_int24(n): ...
def unpack_uint16(n): ...
def unpack_int24(n): ...
def unpack_int32(n): ...
def unpack_int64(n): ...
def defaulterrorhandler(connection, cursor, errorclass, errorvalue): ...

class MysqlPacket:
    connection: Any
    def __init__(self, connection): ...
    def packet_number(self): ...
    def get_all_data(self): ...
    def read(self, size): ...
    def read_all(self): ...
    def advance(self, length): ...
    def rewind(self, position: int = ...): ...
    def peek(self, size): ...
    def get_bytes(self, position, length: int = ...): ...
    def read_length_coded_binary(self): ...
    def read_length_coded_string(self): ...
    def is_ok_packet(self): ...
    def is_eof_packet(self): ...
    def is_resultset_packet(self): ...
    def is_error_packet(self): ...
    def check_error(self): ...
    def dump(self): ...

class FieldDescriptorPacket(MysqlPacket):
    def __init__(self, *args): ...
    def description(self): ...
    def get_column_length(self): ...

class Connection:
    errorhandler: Any
    ssl: Any
    host: Any
    port: Any
    user: Any
    password: Any
    db: Any
    unix_socket: Any
    charset: Any
    use_unicode: Any
    client_flag: Any
    cursorclass: Any
    connect_timeout: Any
    messages: Any
    encoders: Any
    decoders: Any
    host_info: Any
    def __init__(self, host: str = ..., user: Optional[Any] = ..., passwd: str = ..., db: Optional[Any] = ...,
                 port: int = ..., unix_socket: Optional[Any] = ..., charset: str = ..., sql_mode: Optional[Any] = ...,
                 read_default_file: Optional[Any] = ..., conv=..., use_unicode: Optional[Any] = ..., client_flag: int = ...,
                 cursorclass=..., init_command: Optional[Any] = ..., connect_timeout: Optional[Any] = ...,
                 ssl: Optional[Any] = ..., read_default_group: Optional[Any] = ..., compress: Optional[Any] = ...,
                 named_pipe: Optional[Any] = ...): ...
    socket: Any
    rfile: Any
    wfile: Any
    def close(self) -> None: ...
    def autocommit(self, value): ...
    def commit(self): ...
    def begin(self) -> None: ...
    def rollback(self): ...
    def escape(self, obj): ...
    def literal(self, obj): ...
    def cursor(self, cursor: Optional[Type[Cursor]] = ...) -> Cursor: ...
    def __enter__(self): ...
    def __exit__(self, exc, value, traceback): ...
    def query(self, sql): ...
    def next_result(self, unbuffered: bool = ...): ...
    def affected_rows(self): ...
    def kill(self, thread_id): ...
    def ping(self, reconnect: bool = ...): ...
    def set_charset(self, charset): ...
    def read_packet(self, packet_type=...): ...
    def insert_id(self): ...
    def thread_id(self): ...
    def character_set_name(self): ...
    def get_host_info(self): ...
    def get_proto_info(self): ...
    def get_server_info(self): ...
    def show_warnings(self): ...
    Warning: Any
    Error: Any
    InterfaceError: Any
    DatabaseError: Any
    DataError: Any
    OperationalError: Any
    IntegrityError: Any
    InternalError: Any
    ProgrammingError: Any
    NotSupportedError: Any

class MySQLResult:
    connection: Any
    affected_rows: Any
    insert_id: Any
    server_status: Any
    warning_count: Any
    message: Any
    field_count: Any
    description: Any
    rows: Any
    has_next: Any
    def __init__(self, connection): ...
    first_packet: Any
    def read(self): ...
