mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
unnecessary inheritance from ad-hoc protocol (#12882)
This commit is contained in:
@@ -18,13 +18,16 @@ class _TextTestStream(_SupportsWriteAndFlush, Protocol):
|
||||
# _WritelnDecorator should have all the same attrs as its stream param.
|
||||
# But that's not feasible to do Generically
|
||||
# We can expand the attributes if requested
|
||||
class _WritelnDecorator(_TextTestStream):
|
||||
class _WritelnDecorator:
|
||||
def __init__(self, stream: _TextTestStream) -> None: ...
|
||||
def writeln(self, arg: str | None = None) -> str: ...
|
||||
def __getattr__(self, attr: str) -> Any: ... # Any attribute from the stream type passed to __init__
|
||||
# These attributes are prevented by __getattr__
|
||||
stream: Never
|
||||
__getstate__: Never
|
||||
# Methods proxied from the wrapped stream object via __getattr__
|
||||
def flush(self) -> object: ...
|
||||
def write(self, s: str, /) -> object: ...
|
||||
|
||||
_StreamT = TypeVar("_StreamT", bound=_TextTestStream, default=_WritelnDecorator)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user