From 0c42bc6382a677e6fe9b43fcf9837dbbdb6e7714 Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Thu, 23 Mar 2017 14:11:01 -0400 Subject: [PATCH] fixes, refactors --- lbrynet/core/Wallet.py | 6 +++--- lbrynet/lbrynet_daemon/Daemon.py | 6 +++--- lbrynet/lbrynet_daemon/auth/server.py | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lbrynet/core/Wallet.py b/lbrynet/core/Wallet.py index 929def2db..f6bc28711 100644 --- a/lbrynet/core/Wallet.py +++ b/lbrynet/core/Wallet.py @@ -1033,11 +1033,11 @@ class LBRYumWallet(Wallet): def _abandon_claim(self, claim_outpoint): log.debug("Abandon %s %s" % (claim_outpoint['txid'], claim_outpoint['nout'])) broadcast = False - claim_out = yield self._run_cmd_as_defer_succeed( + abandon_tx = yield self._run_cmd_as_defer_succeed( 'abandon', claim_outpoint['txid'], claim_outpoint['nout'], broadcast ) - yield self._broadcast_claim_transaction(claim_out) - defer.returnValue() + claim_out = yield self._broadcast_claim_transaction(abandon_tx) + defer.returnValue(claim_out) def _support_claim(self, name, claim_id, amount): log.debug("Support %s %s %f" % (name, claim_id, amount)) diff --git a/lbrynet/lbrynet_daemon/Daemon.py b/lbrynet/lbrynet_daemon/Daemon.py index 7cdbbab65..293d3f473 100644 --- a/lbrynet/lbrynet_daemon/Daemon.py +++ b/lbrynet/lbrynet_daemon/Daemon.py @@ -1444,9 +1444,8 @@ class Daemon(AuthJSONRPCServer): @AuthJSONRPCServer.auth_required @defer.inlineCallbacks - def jsonrpc_get( - self, name, file_name=None, stream_info=None, timeout=None, - download_directory=None, wait_for_write=True): + def jsonrpc_get(self, name, file_name=None, stream_info=None, timeout=None, + download_directory=None, wait_for_write=True): """ Download stream from a LBRY name. @@ -1764,6 +1763,7 @@ class Daemon(AuthJSONRPCServer): response = yield self._render_response(abandon_claim_tx) except BaseException as err: log.warning(err) + # pylint: disable=unsubscriptable-object if len(err.args) and err.args[0] == "txid was not found in wallet": raise Exception("This transaction was not found in your wallet") else: diff --git a/lbrynet/lbrynet_daemon/auth/server.py b/lbrynet/lbrynet_daemon/auth/server.py index 3e5a7ccf2..bdc71b99c 100644 --- a/lbrynet/lbrynet_daemon/auth/server.py +++ b/lbrynet/lbrynet_daemon/auth/server.py @@ -337,9 +337,10 @@ class AuthJSONRPCServer(AuthorizedBase): @staticmethod def _check_params(function, args_dict): argspec = inspect.getargspec(undecorated(function)) + num_optional_params = 0 if argspec.defaults is None else len(argspec.defaults) missing_required_params = [ required_param - for required_param in argspec.args[1:-len(argspec.defaults or ())] + for required_param in argspec.args[1:-num_optional_params] if required_param not in args_dict ] if len(missing_required_params):