Add missing class pdb.Pdb. (#2872)

Based on: https://docs.python.org/3/library/pdb.html#pdb.Pdb,
with the one difference that the `skip` argument to the
constructor is present in 2.7 despite being listed as new in 3.1.
This commit is contained in:
Rebecca Chen
2019-03-16 14:14:16 -07:00
committed by Sebastian Rittau
parent e541cdd1a6
commit 7c80c52a7a

View File

@@ -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: ...