1from types import TracebackType
2from typing import IO, Iterable, Iterator, List, Optional, Type
3
4
5class NullFile(IO[str]):
6 def close(self) -> None:
7 pass
8
9 def isatty(self) -> bool:
10 return False
11
12 def read(self, __n: int = 1) -> str:
13 return ""
14
15 def readable(self) -> bool:
16 return False
17
18 def readline(self, __limit: int = 1) -> str:
19 return ""
20
21 def readlines(self, __hint: int = 1) -> List[str]:
22 return []
23
24 def seek(self, __offset: int, __whence: int = 1) -> int:
25 return 0
26
27 def seekable(self) -> bool:
28 return False
29
30 def tell(self) -> int:
31 return 0
32
33 def truncate(self, __size: Optional[int] = 1) -> int:
34 return 0
35
36 def writable(self) -> bool:
37 return False
38
39 def writelines(self, __lines: Iterable[str]) -> None:
40 pass
41
42 def __next__(self) -> str:
43 return ""
44
45 def __iter__(self) -> Iterator[str]:
46 return iter([""])
47
48 def __enter__(self) -> IO[str]:
49 return self
50
51 def __exit__(
52 self,
53 __t: Optional[Type[BaseException]],
54 __value: Optional[BaseException],
55 __traceback: Optional[TracebackType],
56 ) -> None:
57 pass
58
59 def write(self, text: str) -> int:
60 return 0
61
62 def flush(self) -> None:
63 pass
64
65 def fileno(self) -> int:
66 return -1
67
68
69NULL_FILE = NullFile()