spacing after comma fix, use Exception init in InvalidStreamInfoError

This commit is contained in:
kkurokawa 2016-11-01 16:35:44 -04:00
parent 39b47bc569
commit 7dd5e7ceeb
3 changed files with 5 additions and 6 deletions

View file

@ -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

View file

@ -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)

View file

@ -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: