diff --git a/stdlib/2and3/pdb.pyi b/stdlib/2and3/pdb.pyi index d63eaf0a6..e403c36ca 100644 --- a/stdlib/2and3/pdb.pyi +++ b/stdlib/2and3/pdb.pyi @@ -1,7 +1,11 @@ # NOTE: This stub is incomplete - only contains some global functions +from cmd import Cmd import sys -from typing import Any, Dict, Optional +from types import FrameType +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar + +_T = TypeVar('_T') class Restart(Exception): ... @@ -19,3 +23,40 @@ else: def post_mortem(t: Optional[Any] = ...) -> None: ... def pm() -> None: ... + +class Pdb(Cmd): + if sys.version_info >= (3, 6): + def __init__( + self, + completekey: str = ..., + stdin: Optional[IO[str]] = ..., + stdout: Optional[IO[str]] = ..., + skip: Optional[Iterable[str]] = ..., + nosigint: bool = ..., + readrc: bool = ..., + ) -> None: ... + elif sys.version_info >= (3, 2): + def __init__( + self, + completekey: str = ..., + stdin: Optional[IO[str]] = ..., + stdout: Optional[IO[str]] = ..., + skip: Optional[Iterable[str]] = ..., + nosigint: bool = ..., + ) -> None: ... + else: + def __init__( + self, + completekey: str = ..., + stdin: Optional[IO[str]] = ..., + stdout: Optional[IO[str]] = ..., + skip: Optional[Iterable[str]] = ..., + ) -> None: ... + # TODO: The run* and set_trace() methods are actually defined on bdb.Bdb, from which Pdb inherits. + # Move these methods there once we have a bdb stub. + def run(self, statement: str, globals: Optional[Dict[str, Any]] = ..., + locals: Optional[Dict[str, Any]] = ...) -> None: ... + def runeval(self, expression: str, globals: Optional[Dict[str, Any]] = ..., + locals: Optional[Dict[str, Any]] = ...) -> Any: ... + def runcall(self, func: Callable[..., _T], *args: Any, **kwds: Any) -> Optional[_T]: ... + def set_trace(self, frame: Optional[FrameType] = ...) -> None: ...