Show More
@@ -244,13 +244,17 b' class bytestr(bytes):' | |||
|
244 | 244 | s = str(s).encode('ascii') |
|
245 | 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 | 250 | s = bytes.__getitem__(self, key) |
|
249 | 251 | if not isinstance(s, bytes): |
|
250 | 252 | s = bytechr(s) |
|
251 | 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 | 258 | return iterbytestr(bytes.__iter__(self)) |
|
255 | 259 | |
|
256 | 260 | def __repr__(self) -> str: |
General Comments 0
You need to be logged in to leave comments.
Login now