From 0becc5bdeb179e4fac34d38041a6dbe779cc3238 Mon Sep 17 00:00:00 2001 From: "kuldeep.k@cisinlabs.com" Date: Mon, 9 Aug 2021 20:52:50 +0530 Subject: [PATCH] Updated code quality binary operator based changes in api.py --- src/api.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/api.py b/src/api.py index 9c0c18a7..c3b3919e 100644 --- a/src/api.py +++ b/src/api.py @@ -1,6 +1,5 @@ # Copyright (c) 2012-2016 Jonathan Warren # Copyright (c) 2012-2020 The Bitmessage developers -# pylint: disable=too-many-lines,no-self-use,unused-variable,unused-argument """ This is not what you run to start the Bitmessage API. @@ -1257,16 +1256,19 @@ class BMRPCDispatcher(object): # the message itself. Please do not yet add this to the api doc. encryptedPayload = self._decode(encryptedPayload, "hex") # Let us do the POW and attach it to the front - target = 2**64 / (( - len(encryptedPayload) + requiredPayloadLengthExtraBytes + 8) * - requiredAverageProofOfWorkNonceTrialsPerByte) + target = 2**64 / ( + ( + len(encryptedPayload) + + requiredPayloadLengthExtraBytes + + 8 + ) * requiredAverageProofOfWorkNonceTrialsPerByte) logger.info( '(For msg message via API) Doing proof of work. Total required' ' difficulty: %s\nRequired small message difficulty: %s', - float(requiredAverageProofOfWorkNonceTrialsPerByte) / - defaults.networkDefaultProofOfWorkNonceTrialsPerByte, - float(requiredPayloadLengthExtraBytes) / - defaults.networkDefaultPayloadLengthExtraBytes, + float(requiredAverageProofOfWorkNonceTrialsPerByte) + / defaults.networkDefaultProofOfWorkNonceTrialsPerByte, + float(requiredPayloadLengthExtraBytes) + / defaults.networkDefaultPayloadLengthExtraBytes, ) powStartTime = time.time() initialHash = hashlib.sha512(encryptedPayload).digest()