electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit d63e754c6737a4ac4b43236eeb6bde48b3737fbd
parent 2f58d419dc8307c62478f6a171eafafb23d9127e
Author: Neil Booth <kyuupichan@gmail.com>
Date:   Fri,  1 Jan 2016 19:15:01 +0900

Remove some unused hook infrastructure

Diffstat:
Melectrum | 4+---
Mlib/plugins.py | 8+-------
Mplugins/ledger/cmdline.py | 7+------
3 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/electrum b/electrum @@ -79,7 +79,7 @@ if is_bundle or is_local or is_android: from electrum import util from electrum import SimpleConfig, Network, Wallet, WalletStorage from electrum.util import print_msg, print_error, print_stderr, json_encode, json_decode, set_verbosity, InvalidPassword -from electrum.plugins import Plugins, run_hook, always_hook +from electrum.plugins import Plugins, run_hook from electrum.commands import get_parser, known_commands, Commands, config_variables from electrum.daemon import Daemon, get_daemon @@ -242,8 +242,6 @@ def run_offline_command(config, config_options): sys.exit(1) if cmd.requires_network: print_stderr("Warning: running command offline") - # notify plugins - always_hook('cmdline_load_wallet', wallet) # arguments passed to function args = map(lambda x: config.get(x), cmd.params) # decode json arguments diff --git a/lib/plugins.py b/lib/plugins.py @@ -145,16 +145,10 @@ def hook(func): return func def run_hook(name, *args): - return _run_hook(name, False, *args) - -def always_hook(name, *args): - return _run_hook(name, True, *args) - -def _run_hook(name, always, *args): results = [] f_list = hooks.get(name, []) for p, f in f_list: - if always or p.is_enabled(): + if p.is_enabled(): try: r = f(*args) except Exception: diff --git a/plugins/ledger/cmdline.py b/plugins/ledger/cmdline.py @@ -1,6 +1,5 @@ from legder import LedgerPlugin from electrum.util import print_msg -from electrum.plugins import hook class BTChipCmdLineHandler: def stop(self): @@ -18,8 +17,4 @@ class BTChipCmdLineHandler: return response class Plugin(LedgerPlugin): - @hook - def cmdline_load_wallet(self, wallet): - wallet.plugin = self - if self.handler is None: - self.handler = BTChipCmdLineHandler() + handler = BTChipCmdLineHandler()