From 82b69109bddf2c3e9478a911880e19e6d7a03363 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Fri, 5 Jun 2020 00:51:55 -0400 Subject: [PATCH] pylint --- lbry/blockchain/transaction.py | 5 ++++- lbry/cli.py | 2 +- lbry/conf.py | 2 +- lbry/console.py | 2 +- lbry/dht/serialization/datagram.py | 6 +++--- lbry/error/generate.py | 2 +- lbry/file_analysis.py | 4 ++-- lbry/service/parser.py | 2 +- lbry/wallet/account.py | 2 +- 9 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lbry/blockchain/transaction.py b/lbry/blockchain/transaction.py index 95112adb2..bd5eff85f 100644 --- a/lbry/blockchain/transaction.py +++ b/lbry/blockchain/transaction.py @@ -372,7 +372,10 @@ class Output(InputOutput): def is_signature_valid(encoded_signature, signature_digest, public_key_bytes): try: public_key = load_der_public_key(public_key_bytes, default_backend()) - public_key.verify(encoded_signature, signature_digest, ec.ECDSA(Prehashed(hashes.SHA256()))) + public_key.verify( # pylint: disable=no-value-for-parameter + encoded_signature, signature_digest, + ec.ECDSA(Prehashed(hashes.SHA256())) + ) return True except (ValueError, InvalidSignature): pass diff --git a/lbry/cli.py b/lbry/cli.py index 991097f19..b6f5a0ed5 100644 --- a/lbry/cli.py +++ b/lbry/cli.py @@ -41,7 +41,7 @@ class ArgumentParser(argparse.ArgumentParser): self._optionals.title = 'Options' if group_name is None: self.epilog = ( - f"Run 'lbrynet COMMAND --help' for more information on a command or group." + "Run 'lbrynet COMMAND --help' for more information on a command or group." ) else: self.epilog = ( diff --git a/lbry/conf.py b/lbry/conf.py index afe28a6da..0c2d01252 100644 --- a/lbry/conf.py +++ b/lbry/conf.py @@ -192,7 +192,7 @@ class MaxKeyFee(Setting[dict]): ) parser.add_argument( self.no_cli_name, - help=f"Disable maximum key fee check.", + help="Disable maximum key fee check.", dest=self.name, const=None, action="store_const", diff --git a/lbry/console.py b/lbry/console.py index 812ff38c8..ff5dc9c4c 100644 --- a/lbry/console.py +++ b/lbry/console.py @@ -35,7 +35,7 @@ class Basic(Console): elif isinstance(self.service, LightClient): s.append('Light Client') if conf.processes == -1: - s.append(f'Threads Only') + s.append('Threads Only') elif conf.processes == 0: s.append(f'{os.cpu_count()} Process(es)') else: diff --git a/lbry/dht/serialization/datagram.py b/lbry/dht/serialization/datagram.py index 5ac6d489f..65780a9bb 100644 --- a/lbry/dht/serialization/datagram.py +++ b/lbry/dht/serialization/datagram.py @@ -171,7 +171,7 @@ def decode_datagram(datagram: bytes) -> typing.Union[RequestDatagram, ResponseDa def make_compact_ip(address: str) -> bytearray: compact_ip = reduce(lambda buff, x: buff + bytearray([int(x)]), address.split('.'), bytearray()) if len(compact_ip) != 4: - raise ValueError(f"invalid IPv4 length") + raise ValueError("invalid IPv4 length") return compact_ip @@ -180,7 +180,7 @@ def make_compact_address(node_id: bytes, address: str, port: int) -> bytearray: if not 0 < port < 65536: raise ValueError(f'Invalid port: {port}') if len(node_id) != constants.HASH_BITS // 8: - raise ValueError(f"invalid node node_id length") + raise ValueError("invalid node node_id length") return compact_ip + port.to_bytes(2, 'big') + node_id @@ -191,5 +191,5 @@ def decode_compact_address(compact_address: bytes) -> typing.Tuple[bytes, str, i if not 0 < port < 65536: raise ValueError(f'Invalid port: {port}') if len(node_id) != constants.HASH_BITS // 8: - raise ValueError(f"invalid node node_id length") + raise ValueError("invalid node node_id length") return node_id, address, port diff --git a/lbry/error/generate.py b/lbry/error/generate.py index 1752e8452..94e9f6eb1 100644 --- a/lbry/error/generate.py +++ b/lbry/error/generate.py @@ -63,7 +63,7 @@ class ErrorClass: @staticmethod def get_fields(args): if len(args) > 1: - return f''.join(f'\n{INDENT*2}self.{field} = {field}' for field in args[1:]) + return ''.join(f'\n{INDENT*2}self.{field} = {field}' for field in args[1:]) return '' @staticmethod diff --git a/lbry/file_analysis.py b/lbry/file_analysis.py index 21dd8df61..624e4b60f 100644 --- a/lbry/file_analysis.py +++ b/lbry/file_analysis.py @@ -69,8 +69,8 @@ class VideoFileAnalyzer: version = str(e) if code != 0 or not version.startswith("ffmpeg"): log.warning("Unable to run ffmpeg, but it was requested. Code: %d; Message: %s", code, version) - raise FileNotFoundError(f"Unable to locate or run ffmpeg or ffprobe. Please install FFmpeg " - f"and ensure that it is callable via PATH or conf.ffmpeg_path") + raise FileNotFoundError("Unable to locate or run ffmpeg or ffprobe. Please install FFmpeg " + "and ensure that it is callable via PATH or conf.ffmpeg_path") log.debug("Using %s at %s", version.splitlines()[0].split(" Copyright")[0], self._which_ffmpeg) return version diff --git a/lbry/service/parser.py b/lbry/service/parser.py index 9ed95b44e..635c4b557 100644 --- a/lbry/service/parser.py +++ b/lbry/service/parser.py @@ -285,7 +285,7 @@ def get_api_definitions(cls): def write(fp): fp.write('# pylint: skip-file\n') fp.write('# DO NOT EDIT: GENERATED FILE\n') - fp.write(f'interface = ') + fp.write('interface = ') defs = get_api_definitions(api.API) for c in defs['commands'].values(): del c['method'] diff --git a/lbry/wallet/account.py b/lbry/wallet/account.py index ee0728f8c..faa4e7225 100644 --- a/lbry/wallet/account.py +++ b/lbry/wallet/account.py @@ -75,7 +75,7 @@ class AddressManager: async def ensure_address_gap(self): raise NotImplementedError - def get_address_records(self, only_usable: bool = False, **constraints): + async def get_address_records(self, only_usable: bool = False, **constraints): raise NotImplementedError async def get_addresses(self, only_usable: bool = False, **constraints) -> List[str]: