tFix docstring display. - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 36aaad392dec6282c6519796057f6c7b047c25f6 DIR parent 34955bd0f5525c83edbd95fba5ab9a3d6c3ff537 HTML Author: Neil Booth <kyuupichan@gmail.com> Date: Sat, 12 Dec 2015 18:11:07 +0900 Fix docstring display. Diffstat: M gui/qt/main_window.py | 7 +++++-- M lib/coinchooser.py | 26 ++++++++++++-------------- 2 files changed, 17 insertions(+), 16 deletions(-) --- DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py t@@ -2583,11 +2583,14 @@ class ElectrumWindow(QMainWindow, PrintError): nz.valueChanged.connect(on_nz) gui_widgets.append((nz_label, nz)) + def fmt_docs(key, klass): + lines = [ln.lstrip(" ") for ln in klass.__doc__.split("\n")] + return '\n'.join([key, "", " ".join(lines)]) + choosers = sorted(COIN_CHOOSERS.keys()) chooser_name = self.wallet.coin_chooser_name(self.config) msg = _('Choose coin (UTXO) selection method. The following are available:\n\n') - msg += '\n\n'.join(key + ": " + klass.__doc__ - for key, klass in COIN_CHOOSERS.items()) + msg += '\n\n'.join(fmt_docs(*item) for item in COIN_CHOOSERS.items()) chooser_label = HelpLabel(_('Coin selection') + ':', msg) chooser_combo = QComboBox() chooser_combo.addItems(choosers) DIR diff --git a/lib/coinchooser.py b/lib/coinchooser.py t@@ -117,10 +117,9 @@ class CoinChooserBase(PrintError): return tx class CoinChooserClassic(CoinChooserBase): - ''' - The classic electrum algorithm. Chooses coins starting with - the oldest that are sufficient to cover the spent amount, and - then removes any unneeded starting with the smallest in value.''' + '''The classic electrum algorithm. Chooses coins starting with the + oldest that are sufficient to cover the spent amount, and then + removes any unneeded starting with the smallest in value.''' def keys(self, coins): return [coin['prevout_hash'] + ':' + str(coin['prevout_n']) t@@ -179,19 +178,18 @@ class CoinChooserRandom(CoinChooserBase): return winner class CoinChooserPrivacy(CoinChooserRandom): - ''' - Attempts to better preserve user privacy. First, if any coin is + '''Attempts to better preserve user privacy. First, if any coin is spent from a user address, all coins are. Compared to spending from other addresses to make up an amount, this reduces information leakage about sender holdings. It also helps to - reduce blockchain UTXO bloat, and reduce future privacy loss - that would come from reusing that address' remaining UTXOs. - Second, it penalizes change that is quite different to the sent - amount. Third, it penalizes change that is too big. Fourth, it - breaks large change up into amounts comparable to the spent - amount. Finally, change is rounded to similar precision to - sent amounts. Extra change outputs and rounding might raise - the transaction fee slightly''' + reduce blockchain UTXO bloat, and reduce future privacy loss that + would come from reusing that address' remaining UTXOs. Second, it + penalizes change that is quite different to the sent amount. + Third, it penalizes change that is too big. Fourth, it breaks + large change up into amounts comparable to the spent amount. + Finally, change is rounded to similar precision to sent amounts. + Extra change outputs and rounding might raise the transaction fee + slightly.''' def keys(self, coins): return [coin['address'] for coin in coins]