Skip to content

Commit 0f8f9b9

Browse files
committed
code cleanup
readability improvement suggested by ruff
1 parent 651e4c5 commit 0f8f9b9

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/hpack/huffman.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ def encode(self, bytes_to_encode: bytes | None) -> bytes:
4444
final_num <<= bits_to_be_padded
4545
final_num |= (1 << bits_to_be_padded) - 1
4646

47-
# Convert the number to hex and strip off the leading '0x' and the
48-
# trailing 'L', if present.
49-
s = hex(final_num)[2:].rstrip("L")
47+
# Convert the number to hex without leading '0x' or trailing 'L'.
48+
s = f"{final_num:x}"
5049

5150
# If this is odd, prepend a zero.
5251
s = "0" + s if len(s) % 2 != 0 else s

0 commit comments

Comments
 (0)