From 7dd5e7ceebbdde59f148a2217aec30341ac45c22 Mon Sep 17 00:00:00 2001 From: kkurokawa Date: Tue, 1 Nov 2016 16:35:44 -0400 Subject: [PATCH] spacing after comma fix, use Exception init in InvalidStreamInfoError --- lbrynet/core/Error.py | 5 ++--- lbrynet/core/Wallet.py | 4 ++-- lbrynet/lbrynet_console/ControlHandlers.py | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lbrynet/core/Error.py b/lbrynet/core/Error.py index dcf9bbec6..7bade2561 100644 --- a/lbrynet/core/Error.py +++ b/lbrynet/core/Error.py @@ -54,12 +54,11 @@ class InvalidStreamDescriptorError(Exception): class InvalidStreamInfoError(Exception): def __init__(self, name, stream_info): + msg = '{} has claim with invalid stream info: {}'.format(name, stream_info) + Exception.__init__(self, msg) self.name = name self.stream_info = stream_info - def __str__(self): - return '{} has claim with invalid stream info: {}'.format(self.name,self.stream_info) - class MisbehavingPeerError(Exception): pass diff --git a/lbrynet/core/Wallet.py b/lbrynet/core/Wallet.py index 3171f2f6b..47eef63a8 100644 --- a/lbrynet/core/Wallet.py +++ b/lbrynet/core/Wallet.py @@ -344,7 +344,7 @@ class Wallet(object): try: metadata = Metadata(json.loads(result['value'])) - except (TypeError,ValueError,ValidationError): + except (TypeError, ValueError, ValidationError): return Failure(InvalidStreamInfoError(name,result['value'])) txid = result['txid'] @@ -427,7 +427,7 @@ class Wallet(object): meta_ver = metadata.version sd_hash = metadata['sources']['lbry_sd_hash'] d = self._save_name_metadata(name, txid, sd_hash) - except (TypeError,ValueError,ValidationError): + except (TypeError, ValueError, ValidationError): metadata = claim['value'] meta_ver = "Non-compliant" d = defer.succeed(None) diff --git a/lbrynet/lbrynet_console/ControlHandlers.py b/lbrynet/lbrynet_console/ControlHandlers.py index 6b5e075f8..876912fcb 100644 --- a/lbrynet/lbrynet_console/ControlHandlers.py +++ b/lbrynet/lbrynet_console/ControlHandlers.py @@ -900,7 +900,7 @@ class AddStreamFromLBRYcrdName(AddStreamFromHash): def _resolve_name(self, name): def get_name_from_info(stream_info): if 'stream_hash' not in stream_info: - raise InvalidStreamInfoError(name,stream_info) + raise InvalidStreamInfoError(name, stream_info) self.resolved_name = stream_info.get('name', None) self.description = stream_info.get('description', None) try: