##// END OF EJS Templates
typing: disable `signature-mismatch` warnings on a few bytestr functions...
Matt Harbison -
r50996:b900f40c default
parent child Browse files
Show More
@@ -244,13 +244,17 b' class bytestr(bytes):'
244 s = str(s).encode('ascii')
244 s = str(s).encode('ascii')
245 return bytes.__new__(cls, s)
245 return bytes.__new__(cls, s)
246
246
247 def __getitem__(self, key) -> bytes:
247 # The base class uses `int` return in py3, but the point of this class is to
248 # behave like py2.
249 def __getitem__(self, key) -> bytes: # pytype: disable=signature-mismatch
248 s = bytes.__getitem__(self, key)
250 s = bytes.__getitem__(self, key)
249 if not isinstance(s, bytes):
251 if not isinstance(s, bytes):
250 s = bytechr(s)
252 s = bytechr(s)
251 return s
253 return s
252
254
253 def __iter__(self) -> Iterator[bytes]:
255 # The base class expects `Iterator[int]` return in py3, but the point of
256 # this class is to behave like py2.
257 def __iter__(self) -> Iterator[bytes]: # pytype: disable=signature-mismatch
254 return iterbytestr(bytes.__iter__(self))
258 return iterbytestr(bytes.__iter__(self))
255
259
256 def __repr__(self) -> str:
260 def __repr__(self) -> str:
General Comments 0
You need to be logged in to leave comments. Login now