Fix ruff checks

This commit is contained in:
Patrick Robertson 2025-01-17 12:15:46 +01:00
parent 68c034ba81
commit 3b0a867b77

View File

@ -1344,14 +1344,14 @@ def _generate_token(self, tweet_id: str) -> str:
# Convert to base 36
base_36 = ''
while result >= 1:
base_36 = "0123456789abcdefghijklmnopqrstuvwxyz"[int(result % 36)] + base_36
base_36 = '0123456789abcdefghijklmnopqrstuvwxyz'[int(result % 36)] + base_36
result = math.floor(result / 36)
# Append fractional part in base 36
while fractional_part > 0 and len(base_36) < 11: # Limit to avoid infinite loop
fractional_part *= 36
digit = int(fractional_part)
base_36 += "0123456789abcdefghijklmnopqrstuvwxyz"[digit]
base_36 += '0123456789abcdefghijklmnopqrstuvwxyz'[digit]
fractional_part -= digit
# Remove leading zeros and dots