Skip to content

Adding pymysql stubs to third_party/2and3 #861

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jan 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions third_party/2and3/pymysql/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Stubs for pymysql (Python 3.5)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

from typing import Union, Tuple, Callable
from .connections import Connection
from .constants import FIELD_TYPE as FIELD_TYPE
from .converters import escape_dict as escape_dict, escape_sequence as escape_sequence, escape_string as escape_string
from .err import 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, MySQLError as MySQLError
from .times import Date as Date, Time as Time, Timestamp as Timestamp, DateFromTicks as DateFromTicks, TimeFromTicks as TimeFromTicks, TimestampFromTicks as TimestampFromTicks

threadsafety = ... # type: int
apilevel = ... # type: str
paramstyle = ... # type: str

class DBAPISet(frozenset):
def __ne__(self, other) -> bool: ...
def __eq__(self, other) -> bool: ...
def __hash__(self) -> int: ...

STRING = ... # type: DBAPISet
BINARY = ... # type: DBAPISet
NUMBER = ... # type: DBAPISet
DATE = ... # type: DBAPISet
TIME = ... # type: DBAPISet
TIMESTAMP = ... # type: DBAPISet
ROWID = ... # type: DBAPISet

def Binary(x) -> Union[bytearray, bytes]: ...
def Connect(*args, **kwargs) -> Connection: ...
def get_client_info() -> str: ...

connect = ... # type: Callable[..., Connection]


version_info = ... # type: Tuple[int, int, int, str, int]
NULL = ... # type: str

def install_as_MySQLdb() -> None: ...
20 changes: 20 additions & 0 deletions third_party/2and3/pymysql/charset.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Stubs for pymysql.charset (Python 3.5)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

from typing import Any

MBLENGTH = ... # type: Any

class Charset:
is_default = ... # type: Any
def __init__(self, id, name, collation, is_default): ...

class Charsets:
def __init__(self): ...
def add(self, c): ...
def by_id(self, id): ...
def by_name(self, name): ...

def charset_by_name(name): ...
def charset_by_id(id): ...
142 changes: 142 additions & 0 deletions third_party/2and3/pymysql/connections.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Stubs for pymysql.connections (Python 3.5)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

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 = ... # type: Any
SSL_ENABLED = ... # type: Any
DEFAULT_USER = ... # type: Any
DEBUG = ... # type: Any
NULL_COLUMN = ... # type: Any
UNSIGNED_CHAR_COLUMN = ... # type: Any
UNSIGNED_SHORT_COLUMN = ... # type: Any
UNSIGNED_INT24_COLUMN = ... # type: Any
UNSIGNED_INT64_COLUMN = ... # type: Any
UNSIGNED_CHAR_LENGTH = ... # type: Any
UNSIGNED_SHORT_LENGTH = ... # type: Any
UNSIGNED_INT24_LENGTH = ... # type: Any
UNSIGNED_INT64_LENGTH = ... # type: Any
DEFAULT_CHARSET = ... # type: Any

def dump_packet(data): ...

SCRAMBLE_LENGTH_323 = ... # type: Any

class RandStruct_323:
max_value = ... # type: Any
seed1 = ... # type: Any
seed2 = ... # type: 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 = ... # type: 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=0): ...
def peek(self, size): ...
def get_bytes(self, position, length=1): ...
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 = ... # type: Any
ssl = ... # type: Any
host = ... # type: Any
port = ... # type: Any
user = ... # type: Any
password = ... # type: Any
db = ... # type: Any
unix_socket = ... # type: Any
charset = ... # type: Any
use_unicode = ... # type: Any
client_flag = ... # type: Any
cursorclass = ... # type: Any
connect_timeout = ... # type: Any
messages = ... # type: Any
encoders = ... # type: Any
decoders = ... # type: Any
host_info = ... # type: Any
def __init__(self, host='', user=None, passwd='', db=None, port=3306, unix_socket=None, charset='', sql_mode=None, read_default_file=None, conv=..., use_unicode=None, client_flag=0, cursorclass=..., init_command=None, connect_timeout=None, ssl=None, read_default_group=None, compress=None, named_pipe=None): ...
socket = ... # type: Any
rfile = ... # type: Any
wfile = ... # type: Any
def close(self): ...
def autocommit(self, value): ...
def commit(self): ...
def rollback(self): ...
def escape(self, obj): ...
def literal(self, obj): ...
def cursor(self, cursor: Optional[Type[Cursor]]=None): ...
def __enter__(self): ...
def __exit__(self, exc, value, traceback): ...
def query(self, sql): ...
def next_result(self): ...
def affected_rows(self): ...
def kill(self, thread_id): ...
def ping(self, reconnect=True): ...
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): ...
Warning = ... # type: Any
Error = ... # type: Any
InterfaceError = ... # type: Any
DatabaseError = ... # type: Any
DataError = ... # type: Any
OperationalError = ... # type: Any
IntegrityError = ... # type: Any
InternalError = ... # type: Any
ProgrammingError = ... # type: Any
NotSupportedError = ... # type: Any

class MySQLResult:
connection = ... # type: Any
affected_rows = ... # type: Any
insert_id = ... # type: Any
server_status = ... # type: Any
warning_count = ... # type: Any
message = ... # type: Any
field_count = ... # type: Any
description = ... # type: Any
rows = ... # type: Any
has_next = ... # type: Any
def __init__(self, connection): ...
first_packet = ... # type: Any
def read(self): ...
24 changes: 24 additions & 0 deletions third_party/2and3/pymysql/constants/CLIENT.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Stubs for pymysql.constants.CLIENT (Python 3.5)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

from typing import Any

LONG_PASSWORD = ... # type: Any
FOUND_ROWS = ... # type: Any
LONG_FLAG = ... # type: Any
CONNECT_WITH_DB = ... # type: Any
NO_SCHEMA = ... # type: Any
COMPRESS = ... # type: Any
ODBC = ... # type: Any
LOCAL_FILES = ... # type: Any
IGNORE_SPACE = ... # type: Any
PROTOCOL_41 = ... # type: Any
INTERACTIVE = ... # type: Any
SSL = ... # type: Any
IGNORE_SIGPIPE = ... # type: Any
TRANSACTIONS = ... # type: Any
SECURE_CONNECTION = ... # type: Any
MULTI_STATEMENTS = ... # type: Any
MULTI_RESULTS = ... # type: Any
CAPABILITIES = ... # type: Any
28 changes: 28 additions & 0 deletions third_party/2and3/pymysql/constants/COMMAND.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Stubs for pymysql.constants.COMMAND (Python 3.5)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

from typing import Any

COM_SLEEP = ... # type: Any
COM_QUIT = ... # type: Any
COM_INIT_DB = ... # type: Any
COM_QUERY = ... # type: Any
COM_FIELD_LIST = ... # type: Any
COM_CREATE_DB = ... # type: Any
COM_DROP_DB = ... # type: Any
COM_REFRESH = ... # type: Any
COM_SHUTDOWN = ... # type: Any
COM_STATISTICS = ... # type: Any
COM_PROCESS_INFO = ... # type: Any
COM_CONNECT = ... # type: Any
COM_PROCESS_KILL = ... # type: Any
COM_DEBUG = ... # type: Any
COM_PING = ... # type: Any
COM_TIME = ... # type: Any
COM_DELAYED_INSERT = ... # type: Any
COM_CHANGE_USER = ... # type: Any
COM_BINLOG_DUMP = ... # type: Any
COM_TABLE_DUMP = ... # type: Any
COM_CONNECT_OUT = ... # type: Any
COM_REGISTER_SLAVE = ... # type: Any
Loading