Format code with yapf

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

Details: https://deepsource.io/gh/kokarare1212/librespot-python/transform/8e6824e5-7766-454b-8f74-5f0e8fca4a70/
This commit is contained in:
deepsource-autofix[bot] 2021-09-14 10:23:35 +00:00 committed by GitHub
parent c2bfa04c35
commit 6bdd78b3d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 5 deletions

View File

@ -1105,7 +1105,11 @@ class Session(Closeable, MessageListener, SubListener):
sha1 = SHA1.new()
sha1.update(device_id.encode())
secret = sha1.digest()
base_key = PBKDF2(secret, username.encode(), 20, 0x100, hmac_hash_module=SHA1)
base_key = PBKDF2(secret,
username.encode(),
20,
0x100,
hmac_hash_module=SHA1)
sha1 = SHA1.new()
sha1.update(base_key)
key = sha1.digest() + b"\x00\x00\x00\x14"

View File

@ -144,7 +144,11 @@ class ZeroconfServer(Closeable):
__socket.send(self.__eol)
__socket.send(self.__eol)
return
aes = AES.new(encryption_key[:16], AES.MODE_CTR, counter=Counter.new(128, initial_value=int.from_bytes(iv, "big")))
aes = AES.new(encryption_key[:16],
AES.MODE_CTR,
counter=Counter.new(128,
initial_value=int.from_bytes(
iv, "big")))
decrypted = aes.decrypt(encrypted)
with self.__connection_lock:
self.__connecting_username = username
@ -180,7 +184,7 @@ class ZeroconfServer(Closeable):
with self.__connection_lock:
info[
"activeUser"] = self.__connecting_username if self.__connecting_username is not None else self.__session.username(
) if self.has_valid_session() else ""
) if self.has_valid_session() else ""
__socket.send(http_version.encode())
__socket.send(b" 200 OK")
__socket.send(self.__eol)
@ -215,7 +219,9 @@ class ZeroconfServer(Closeable):
self.__socket.bind((".".join(["0"] * 4), port))
self.__socket.listen(5)
self.__zeroconf_server = zeroconf_server
logging.info("Zeroconf HTTP server started successfully on port {}!".format(port))
logging.info(
"Zeroconf HTTP server started successfully on port {}!".format(
port))
def close(self) -> None:
pass
@ -280,7 +286,8 @@ class ZeroconfServer(Closeable):
if action == "addUser":
if params is None:
raise RuntimeError
self.__zeroconf_server.handle_add_user(__socket, params, http_version)
self.__zeroconf_server.handle_add_user(__socket, params,
http_version)
elif action == "getInfo":
self.__zeroconf_server.handle_get_info(__socket, http_version)
else: