Format code with yapf

This commit fixes the style issues introduced in 2790f48 according to the output
from yapf.

Details: https://deepsource.io/gh/kokarare1212/librespot-python/transform/04a80a03-ea85-44b3-9159-2580bda68c1c/
This commit is contained in:
deepsource-autofix[bot]
2021-09-12 04:58:42 +00:00
committed by GitHub
parent 2790f484c8
commit 0741dbdd43
15 changed files with 396 additions and 237 deletions

View File

@@ -24,14 +24,16 @@ class AesAudioDecrypt(AudioDecrypt):
iv = self.iv_int + int(ChannelManager.chunk_size * chunk_index / 16)
start = time.time_ns()
for i in range(0, len(buffer), 4096):
cipher = AES.new(key=self.key, mode=AES.MODE_CTR,
cipher = AES.new(key=self.key,
mode=AES.MODE_CTR,
counter=Counter.new(128, initial_value=iv))
count = min(4096, len(buffer) - i)
decrypted_buffer = cipher.decrypt(buffer[i:i + count])
new_buffer.write(decrypted_buffer)
if count != len(decrypted_buffer):
raise RuntimeError("Couldn't process all data, actual: {}, expected: {}"
.format(len(decrypted_buffer), count))
raise RuntimeError(
"Couldn't process all data, actual: {}, expected: {}".
format(len(decrypted_buffer), count))
iv += self.iv_diff
self.decrypt_total_time += time.time_ns() - start
self.decrypt_count += 1
@@ -39,4 +41,5 @@ class AesAudioDecrypt(AudioDecrypt):
return new_buffer.read()
def decrypt_time_ms(self):
return 0 if self.decrypt_count == 0 else int((self.decrypt_total_time / self.decrypt_count) / 1000000)
return 0 if self.decrypt_count == 0 else int(
(self.decrypt_total_time / self.decrypt_count) / 1000000)