aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/proto.py
diff options
context:
space:
mode:
authorAstounds <kirito@disroot.org>2026-04-25 01:02:17 -0500
committerAstounds <kirito@disroot.org>2026-04-25 01:02:17 -0500
commit50ad959a8051fec95f26b573f9fe067bdf3fdf6a (patch)
tree4d94f63cf9adb951d4200b0f2bb0c762d45297c4 /youtube/proto.py
parenta0f315be51ef121618e73d5b450c8616c0d11d21 (diff)
downloadyt-local-50ad959a8051fec95f26b573f9fe067bdf3fdf6a.tar.lz
yt-local-50ad959a8051fec95f26b573f9fe067bdf3fdf6a.tar.xz
yt-local-50ad959a8051fec95f26b573f9fe067bdf3fdf6a.zip
refactor: replace string concatenations with f-strings
Diffstat (limited to 'youtube/proto.py')
-rw-r--r--youtube/proto.py9
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)}')