1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#
# Copyright (c), 2024, SISSA (International School for Advanced Studies).
# All rights reserved.
# This file is distributed under the terms of the MIT License.
# See the file 'LICENSE' in the root directory of the present
# distribution, or http://opensource.org/licenses/MIT.
#
# @author Davide Brunato <brunato@sissa.it>
#
from types import TracebackType
from typing import AnyStr, IO, Optional, Protocol, Type
class IOProtocol(Protocol[AnyStr]):
@property
def closed(self) -> bool: ...
def close(self) -> None: ...
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def read(self, n: int = ...) -> AnyStr: ...
def readable(self) -> bool: ...
def readline(self, limit: int = ...) -> AnyStr: ...
def readlines(self, hint: int = ...) -> list[AnyStr]: ...
def seek(self, offset: int, whence: int = ...) -> int: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def __enter__(self) -> 'IOProtocol[AnyStr]': ...
def __exit__(self, exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> None: ...
class FileWrapperProtocol(IOProtocol[AnyStr], Protocol[AnyStr]):
file: IO[AnyStr]
name: str
|