diff options
Diffstat (limited to 'youtube/proto.py')
| -rw-r--r-- | youtube/proto.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/youtube/proto.py b/youtube/proto.py index db83a06..72a8a94 100644 --- a/youtube/proto.py +++ b/youtube/proto.py @@ -76,7 +76,7 @@ def read_varint(data): except IndexError: if i == 0: raise EOFError() - raise Exception('Unterminated varint starting at ' + str(data.tell() - i)) + raise Exception(f'Unterminated varint starting at {data.tell() - i}') result |= (byte & 127) << 7*i if not byte & 128: break @@ -118,7 +118,7 @@ def read_protobuf(data): elif wire_type == 5: value = data.read(4) else: - raise Exception("Unknown wire type: " + str(wire_type) + " at position " + str(data.tell())) + raise Exception(f"Unknown wire type: {wire_type} at position {data.tell()}") yield (wire_type, field_number, value) @@ -170,8 +170,7 @@ def _make_protobuf(data): elif field[0] == 2: result += string(field[1], _make_protobuf(field[2])) else: - raise NotImplementedError('Wire type ' + str(field[0]) - + ' not implemented') + raise NotImplementedError(f'Wire type {field[0]} not implemented') return result return data @@ -218,4 +217,4 @@ def b64_to_bytes(data): if isinstance(data, bytes): data = data.decode('ascii') data = data.replace("%3D", "=") - return base64.urlsafe_b64decode(data + "="*((4 - len(data) % 4) % 4)) + return base64.urlsafe_b64decode(f'{data}={"=" * ((4 - len(data) % 4) % 4)}') |
