Skip to content
Open
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
12 changes: 12 additions & 0 deletions stubs/mysqlclient/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Deprecated reexports that are added via __getattr__().
MySQLdb.cursors.BaseCursor.DataError
MySQLdb.cursors.BaseCursor.DatabaseError
MySQLdb.cursors.BaseCursor.Error
MySQLdb.cursors.BaseCursor.IntegrityError
MySQLdb.cursors.BaseCursor.InterfaceError
MySQLdb.cursors.BaseCursor.InternalError
MySQLdb.cursors.BaseCursor.MySQLError
MySQLdb.cursors.BaseCursor.NotSupportedError
MySQLdb.cursors.BaseCursor.OperationalError
MySQLdb.cursors.BaseCursor.ProgrammingError
MySQLdb.cursors.BaseCursor.Warning
2 changes: 1 addition & 1 deletion stubs/mysqlclient/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "2.2.*"
version = "2.3.*"
upstream-repository = "https://github.com/PyMySQL/mysqlclient"

[tool.stubtest]
Expand Down
12 changes: 10 additions & 2 deletions stubs/mysqlclient/MySQLdb/_mysql.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import builtins
from _typeshed import Incomplete
from typing_extensions import disjoint_base
from typing import overload
from typing_extensions import deprecated, disjoint_base

import MySQLdb._exceptions

Expand Down Expand Up @@ -48,8 +49,15 @@ class connection:
def info(self): ...
def insert_id(self): ...
def kill(self, *args, **kwargs): ...
def more_results(self) -> bool: ...
def next_result(self): ...
def ping(self): ...

@overload
@deprecated("The reconnect parameter of ping() is deprecated.")
def ping(self, reconnect: bool) -> None: ...
@overload
def ping(self) -> None: ...

def query(self, query): ...
def read_query_result(self): ...
def rollback(self): ...
Expand Down
5 changes: 3 additions & 2 deletions stubs/mysqlclient/MySQLdb/connections.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from _typeshed import Incomplete
from re import Pattern
from types import TracebackType
from typing import Any, TypeAlias
from typing import Any, Literal, TypeAlias
from typing_extensions import LiteralString, Self

from . import _mysql, cursors
Expand Down Expand Up @@ -29,11 +29,12 @@ def numeric_part(s): ...

class Connection(_mysql.connection):
default_cursor: type[cursors.Cursor]
executemany_fallback: Literal["loop", "multi"]
cursorclass: type[cursors.BaseCursor]
encoders: Incomplete
encoding: str
messages: Incomplete
def __init__(self, *args, **kwargs) -> None: ...
def __init__(self, *args, executemany_fallback: Literal["loop", "multi"], **kwargs) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
Expand Down
56 changes: 30 additions & 26 deletions stubs/mysqlclient/MySQLdb/cursors.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from re import Pattern
from typing import TypeAlias
from typing_extensions import LiteralString
from typing import Literal, TypeAlias
from typing_extensions import LiteralString, Self

from .connections import _Literal

Expand All @@ -11,28 +11,20 @@ _Arguments: TypeAlias = dict[str, _Literal] | dict[bytes, _Literal] | Iterable[_
RE_INSERT_VALUES: Pattern[str]

class BaseCursor:
from ._exceptions import (
DatabaseError as DatabaseError,
DataError as DataError,
Error as Error,
IntegrityError as IntegrityError,
InterfaceError as InterfaceError,
InternalError as InternalError,
MySQLError as MySQLError,
NotSupportedError as NotSupportedError,
OperationalError as OperationalError,
ProgrammingError as ProgrammingError,
Warning as Warning,
)

max_stmt_length: Incomplete
max_stmt_length: int
max_multi_stmt_length: int
max_multi_stmt_count: int
executemany_fallback: Literal["loop", "multi"] | None
connection: Incomplete
description: Incomplete
description_flags: Incomplete

warning_count: int
description: Incomplete | None
description_flags: Incomplete | None
rowcount: int
arraysize: int
lastrowid: Incomplete
rownumber: Incomplete
lastrowid: Incomplete | None
rownumber: Incomplete | None

def __init__(self, connection) -> None: ...
def close(self) -> None: ...
def __enter__(self): ...
Expand All @@ -44,24 +36,36 @@ class BaseCursor:
def mogrify(self, query: str | bytes, args: _Arguments | None = None) -> str: ...
def executemany(self, query: LiteralString, args: Iterable[_Arguments]) -> int | None: ...
def callproc(self, procname, args=()): ...
def __iter__(self): ...
def __iter__(self) -> Self: ...
def __next__(self): ...

# These are all deprecated.
from ._exceptions import (
DatabaseError as DatabaseError,
DataError as DataError,
Error as Error,
IntegrityError as IntegrityError,
InterfaceError as InterfaceError,
InternalError as InternalError,
MySQLError as MySQLError,
NotSupportedError as NotSupportedError,
OperationalError as OperationalError,
ProgrammingError as ProgrammingError,
Warning as Warning,
)

class CursorStoreResultMixIn:
rownumber: Incomplete
def fetchone(self): ...
def fetchmany(self, size=None): ...
def fetchall(self): ...
def scroll(self, value, mode: str = "relative") -> None: ...
def __iter__(self): ...

class CursorUseResultMixIn:
rownumber: Incomplete
def fetchone(self): ...
def fetchmany(self, size=None): ...
def fetchall(self): ...
def __iter__(self): ...
def next(self): ...
__next__ = next

class CursorTupleRowsMixIn: ...
class CursorDictRowsMixIn: ...
Expand Down