From 4bc8a211a991592290465a2593d77326a67b9cac Mon Sep 17 00:00:00 2001 From: Moul <moul@moul.re> Date: Sun, 26 Sep 2021 13:27:58 +0200 Subject: [PATCH] [mod] #194: verify blocks/cert: Use f-string --- silkaj/blocks.py | 9 +++------ silkaj/cert.py | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/silkaj/blocks.py b/silkaj/blocks.py index 6aa1c761..81197941 100644 --- a/silkaj/blocks.py +++ b/silkaj/blocks.py @@ -44,14 +44,12 @@ def verify_blocks_signatures(from_block, to_block): for chunk_from in bar: chunk_size = get_chunk_size(from_block, to_block, chunks_from, chunk_from) logging.info( - "Processing chunk from block {} to {}".format( - chunk_from, chunk_from + chunk_size - ) + f"Processing chunk from block {chunk_from} to {chunk_from + chunk_size}" ) chunk = get_chunk(client, chunk_size, chunk_from) for block in chunk: - block = Block.from_signed_raw(block["raw"] + block["signature"] + "\n") + block = Block.from_signed_raw(f'{block["raw"]}{block["signature"]}\n') verify_block_signature(invalid_blocks_signatures, block) display_result(from_block, to_block, invalid_blocks_signatures) @@ -63,8 +61,7 @@ def check_passed_blocks_range(client, from_block, to_block): to_block = head_number if to_block > head_number: message_exit( - "Passed TO_BLOCK argument is bigger than the head block: " - + str(head_number) + f"Passed TO_BLOCK argument is bigger than the head block: {str(head_number)}" ) if from_block > to_block: message_exit("TO_BLOCK should be bigger or equal to FROM_BLOCK") diff --git a/silkaj/cert.py b/silkaj/cert.py index de07e2ec..4f4a010d 100644 --- a/silkaj/cert.py +++ b/silkaj/cert.py @@ -99,7 +99,7 @@ def pre_checks(client, issuer_pubkey, pubkey_to_certify): renewable = cert["expiresIn"] - params["sigValidity"] + params["sigReplay"] if renewable > 0: renewable_date = now().add(seconds=renewable).format(DATE) - sys.exit("Certification renewable from " + renewable_date) + sys.exit(f"Certification renewable from {renewable_date}") # Check if the certification is already in the pending certifications for pending_cert in req["pendingCerts"]: -- GitLab