##// END OF EJS Templates
typing: add a fake `__init__()` to bytestr to distract pytype...
Matt Harbison -
r48819:1fda8c93 default
parent child Browse files
Show More
@@ -222,6 +222,15 b' if ispy3:'
222 >>> assert type(t) is bytes
222 >>> assert type(t) is bytes
223 """
223 """
224
224
225 # Trick pytype into not demanding Iterable[int] be passed to __new__(),
226 # since the appropriate bytes format is done internally.
227 #
228 # https://github.com/google/pytype/issues/500
229 if TYPE_CHECKING:
230
231 def __init__(self, s=b''):
232 pass
233
225 def __new__(cls, s=b''):
234 def __new__(cls, s=b''):
226 if isinstance(s, bytestr):
235 if isinstance(s, bytestr):
227 return s
236 return s
General Comments 0
You need to be logged in to leave comments. Login now