50
50
import struct
51
51
import sys
52
52
import time
53
- from typing import Iterator , NoReturn
53
+ from typing import Iterator , NoReturn , List
54
+ from typing_extensions import Literal
54
55
import unicodedata
55
56
from dataclasses import dataclass
56
57
@@ -144,7 +145,7 @@ def writelines(self, l) -> None:
144
145
for s in l :
145
146
self .write (s )
146
147
147
- def isatty (self ) -> True :
148
+ def isatty (self ) -> Literal [ True ] :
148
149
# some third party (amongst them mercurial) depend on this
149
150
return True
150
151
@@ -161,7 +162,7 @@ def __init__(self, interface) -> None:
161
162
162
163
self .encoding = getpreferredencoding ()
163
164
self .interface = interface
164
- self .buffer = list ()
165
+ self .buffer : List [ str ] = list ()
165
166
166
167
def __iter__ (self ) -> Iterator :
167
168
return iter (self .readlines ())
@@ -175,7 +176,7 @@ def write(self, value) -> NoReturn:
175
176
# others, so here's a hack to keep them happy
176
177
raise OSError (errno .EBADF , "sys.stdin is read-only" )
177
178
178
- def isatty (self ) -> True :
179
+ def isatty (self ) -> Literal [ True ] :
179
180
return True
180
181
181
182
def readline (self , size = - 1 ):
0 commit comments