stdlib: fix many attributes which are read-only at runtime but read-write in the stub (#7395)

This commit is contained in:
Alex Waygood
2022-02-28 00:23:09 +00:00
committed by GitHub
parent 46da0b87ea
commit a0b41959ec
17 changed files with 104 additions and 50 deletions

View File

@@ -6,16 +6,20 @@ from typing_extensions import SupportsIndex
def get_object_traceback(obj: object) -> Traceback | None: ...
def take_snapshot() -> Snapshot: ...
class DomainFilter:
class BaseFilter:
inclusive: bool
domain: int
def __init__(self, inclusive: bool) -> None: ...
class DomainFilter(BaseFilter):
@property
def domain(self) -> int: ...
def __init__(self, inclusive: bool, domain: int) -> None: ...
class Filter:
class Filter(BaseFilter):
domain: int | None
inclusive: bool
lineno: int | None
filename_pattern: str
@property
def filename_pattern(self) -> str: ...
all_frames: bool
def __init__(
self, inclusive: bool, filename_pattern: str, lineno: int | None = ..., all_frames: bool = ..., domain: int | None = ...
@@ -40,8 +44,10 @@ class StatisticDiff:
_FrameTupleT = tuple[str, int]
class Frame:
filename: str
lineno: int
@property
def filename(self) -> str: ...
@property
def lineno(self) -> int: ...
def __init__(self, frame: _FrameTupleT) -> None: ...
def __eq__(self, other: object) -> bool: ...
def __lt__(self, other: Frame) -> bool: ...
@@ -60,15 +66,19 @@ else:
_TraceTupleT = tuple[int, int, Sequence[_FrameTupleT]]
class Trace:
domain: int
size: int
traceback: Traceback
@property
def domain(self) -> int: ...
@property
def size(self) -> int: ...
@property
def traceback(self) -> Traceback: ...
def __init__(self, trace: _TraceTupleT) -> None: ...
def __eq__(self, other: object) -> bool: ...
class Traceback(Sequence[Frame]):
if sys.version_info >= (3, 9):
total_nframe: int | None
@property
def total_nframe(self) -> int | None: ...
def __init__(self, frames: Sequence[_FrameTupleT], total_nframe: int | None = ...) -> None: ...
else:
def __init__(self, frames: Sequence[_FrameTupleT]) -> None: ...