From 521e18474ce042f0af4b4943c69120c7f5b96f47 Mon Sep 17 00:00:00 2001 From: Vincent Texier <vit@free.fr> Date: Tue, 15 Jan 2019 19:02:38 +0100 Subject: [PATCH] [fix] fix pycharm alerts Use staticmethod decorators on static methods Reformat code --- duniterpy/key/signing_key.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/duniterpy/key/signing_key.py b/duniterpy/key/signing_key.py index 1286d7c6..4a9c61db 100644 --- a/duniterpy/key/signing_key.py +++ b/duniterpy/key/signing_key.py @@ -154,11 +154,13 @@ pub: {pubkey} sec: {signkey}""".format(version=version, pubkey=base58_public_key, signkey=base58_signing_key) ) - def from_wif_or_ewif_file(path: str, password: str=None) -> SigningKeyType: + @staticmethod + def from_wif_or_ewif_file(path: str, password: str = None) -> SigningKeyType: """ Return SigningKey instance from Duniter WIF or EWIF file :param path: Path to WIF of EWIF file + :param password: Password needed for EWIF file """ with open(path, 'r') as fh: wif_content = fh.read() @@ -173,7 +175,8 @@ sec: {signkey}""".format(version=version, pubkey=base58_public_key, signkey=base wif_hex = match.groups()[0] return SigningKey.from_wif_or_ewif_hex(wif_hex, password) - def from_wif_or_ewif_hex(wif_hex: str, password: str=None) -> SigningKeyType: + @staticmethod + def from_wif_or_ewif_hex(wif_hex: str, password: str = None) -> SigningKeyType: """ Return SigningKey instance from Duniter WIF or EWIF in hexadecimal format @@ -191,7 +194,7 @@ sec: {signkey}""".format(version=version, pubkey=base58_public_key, signkey=base else: raise Exception("Error: Bad format: not WIF nor EWIF") - + @staticmethod def from_wif_file(path: str) -> SigningKeyType: """ Return SigningKey instance from Duniter WIF file @@ -266,6 +269,7 @@ Version: {version} Data: {data}""".format(version=version, data=wif_key) ) + @staticmethod def from_ewif_file(path: str, password: str) -> SigningKeyType: """ Return SigningKey instance from Duniter EWIF file -- GitLab