tMerge pull request #892 from Tafelpoot/whitespace_v2 - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 11fc93dc4add165b9ad69aee24ab45e81be2859d DIR parent 49c0a3a08fb8a14402bd2f91c02c827ab12d6b8d HTML Author: ThomasV <thomasv1@gmx.de> Date: Tue, 21 Oct 2014 23:56:01 +0200 Merge pull request #892 from Tafelpoot/whitespace_v2 removed trailing whitespace and fixed indentation in history widget Diffstat: M gui/qt/__init__.py | 6 ++---- M gui/qt/amountedit.py | 1 - M gui/qt/console.py | 14 +++++++------- M gui/qt/history_widget.py | 11 +++++------ M gui/qt/installwizard.py | 22 +++++++++++----------- M gui/qt/lite_window.py | 41 +++++++++++++++---------------- M gui/qt/main_window.py | 24 ++++++++++++------------ M gui/qt/network_dialog.py | 22 +++++++++++----------- M gui/qt/password_dialog.py | 10 +++------- M gui/qt/paytoedit.py | 5 ++--- M gui/qt/qrcodewidget.py | 5 ++--- M gui/qt/qrwindow.py | 6 +----- M gui/qt/receiving_widget.py | 4 ++-- M gui/qt/seed_dialog.py | 16 ++++++++-------- M gui/qt/transaction_dialog.py | 14 +++++--------- M gui/qt/util.py | 2 +- M gui/qt/version_getter.py | 12 +++++------- M lib/account.py | 6 +----- M lib/blockchain.py | 33 +++++++++++++++---------------- M lib/bmp.py | 61 +++++++++++++++---------------- M lib/i18n.py | 4 ++-- M lib/interface.py | 18 +++++++++--------- M lib/msqr.py | 24 ++++++++++++------------ M lib/network.py | 26 ++++++++++++-------------- M lib/network_proxy.py | 11 +++++------ M lib/paymentrequest.py | 5 ++--- M lib/paymentrequest_pb2.py | 12 ++++++------ M lib/plugins.py | 3 +-- M lib/qrscanner.py | 2 +- M lib/ripemd.py | 22 +++++++++++----------- M lib/synchronizer.py | 7 +++---- M lib/transaction.py | 23 ++++++++++------------- M lib/util.py | 7 +++---- M lib/wallet.py | 6 +++--- M lib/x509.py | 12 ++++++------ 35 files changed, 230 insertions(+), 267 deletions(-) --- DIR diff --git a/gui/qt/__init__.py b/gui/qt/__init__.py t@@ -160,7 +160,7 @@ class ElectrumGui: import installwizard wizard = installwizard.InstallWizard(self.config, self.network, storage) wallet = wizard.run(action) - if not wallet: + if not wallet: return else: wallet.start_threads(self.network) t@@ -203,7 +203,7 @@ class ElectrumGui: s.start() self.windows.append(w) - if url: + if url: self.set_url(url) w.app = self.app t@@ -221,5 +221,3 @@ class ElectrumGui: self.app.sendEvent(self.app.clipboard(), event) w.close_wallet() - - DIR diff --git a/gui/qt/amountedit.py b/gui/qt/amountedit.py t@@ -96,4 +96,3 @@ class BTCAmountEdit(AmountEdit): p = pow(10, self.decimal_point()) x = amount / Decimal(p) self.setText(str(x)) - DIR diff --git a/gui/qt/console.py b/gui/qt/console.py t@@ -35,7 +35,7 @@ class Console(QtGui.QPlainTextEdit): def set_json(self, b): self.is_json = b - + def run_script(self, filename): with open(filename) as f: script = f.read() t@@ -106,7 +106,7 @@ class Console(QtGui.QPlainTextEdit): self.moveCursor(QtGui.QTextCursor.End) self.completions_visible = True - + def hide_completions(self): if not self.completions_visible: t@@ -146,7 +146,7 @@ class Console(QtGui.QPlainTextEdit): def addToHistory(self, command): if command.find("importprivkey") > -1: return - + if command and (not self.history or self.history[-1] != command): self.history.append(command) self.history_index = len(self.history) t@@ -177,7 +177,7 @@ class Console(QtGui.QPlainTextEdit): def register_command(self, c, func): methods = { c: func} self.updateNamespace(methods) - + def runCommand(self): command = self.getCommand() t@@ -232,7 +232,7 @@ class Console(QtGui.QPlainTextEdit): sys.stdout = tmp_stdout self.newPrompt() self.set_json(False) - + def keyPressEvent(self, event): if event.key() == QtCore.Qt.Key_Tab: t@@ -280,7 +280,7 @@ class Console(QtGui.QPlainTextEdit): obj = self.namespace.get(path[0]) prefix = path[0] + '.' ns = dir(obj) - + completions = [] for x in ns: t@@ -289,7 +289,7 @@ class Console(QtGui.QPlainTextEdit): if xx.startswith(lastword): completions.append(xx) completions.sort() - + if not completions: self.hide_completions() elif len(completions) == 1: DIR diff --git a/gui/qt/history_widget.py b/gui/qt/history_widget.py t@@ -14,13 +14,12 @@ class HistoryWidget(QTreeWidget): def append(self, address, amount, date): if address is None: - address = _("Unknown") - if amount is None: - amount = _("Unknown") + address = _("Unknown") + if amount is None: + amount = _("Unknown") if date is None: - date = _("Unknown") + date = _("Unknown") item = QTreeWidgetItem([amount, address, date]) if float(amount) < 0: - item.setForeground(0, QBrush(QColor("#BC1E1E"))) + item.setForeground(0, QBrush(QColor("#BC1E1E"))) self.insertTopLevelItem(0, item) - DIR diff --git a/gui/qt/installwizard.py b/gui/qt/installwizard.py t@@ -97,7 +97,7 @@ class InstallWizard(QDialog): if not self.exec_(): return None, None - + action = 'create' if b1.isChecked() else 'restore' wallet_type = self.wallet_types[group2.checkedId()][0] return action, wallet_type t@@ -184,7 +184,7 @@ class InstallWizard(QDialog): self.set_layout(vbox) if not self.exec_(): - return + return return map(lambda e: self.get_seed_text(e), entries) t@@ -211,7 +211,7 @@ class InstallWizard(QDialog): # skip this if config already exists if self.config.get('server') is not None: return - + grid = QGridLayout() grid.setSpacing(5) t@@ -245,14 +245,14 @@ class InstallWizard(QDialog): self.set_layout(vbox) if not self.exec_(): return - + if b2.isChecked(): return NetworkDialog(self.network, self.config, None).do_exec() else: self.config.set_key('auto_cycle', True, True) return - + def show_message(self, msg, icon=None): vbox = QVBoxLayout() self.set_layout(vbox) t@@ -263,7 +263,7 @@ class InstallWizard(QDialog): vbox.addWidget(QLabel(msg)) vbox.addStretch(1) vbox.addLayout(close_button(self, _('Next'))) - if not self.exec_(): + if not self.exec_(): return None t@@ -302,7 +302,7 @@ class InstallWizard(QDialog): vbox.addWidget(label) vbox.addStretch(1) vbox.addLayout(ok_cancel_buttons(self, yes_label, no_label)) - if not self.exec_(): + if not self.exec_(): return None return True t@@ -400,7 +400,7 @@ class InstallWizard(QDialog): else: f = run_hook('get_wizard_action', self, wallet, action) - if not f: + if not f: raise BaseException('unknown wizard action', action) r = f(wallet, self) if not r: t@@ -461,7 +461,7 @@ class InstallWizard(QDialog): elif t in ['2of2']: r = self.multi_seed_dialog(1) - if not r: + if not r: return text1, text2 = r wallet = Wallet_2of2(self.storage) t@@ -491,7 +491,7 @@ class InstallWizard(QDialog): elif t in ['2of3']: r = self.multi_seed_dialog(2) - if not r: + if not r: return text1, text2, text3 = r wallet = Wallet_2of3(self.storage) t@@ -536,5 +536,5 @@ class InstallWizard(QDialog): # create first keys offline self.waiting_dialog(wallet.synchronize) - + return wallet DIR diff --git a/gui/qt/lite_window.py b/gui/qt/lite_window.py t@@ -88,7 +88,7 @@ class TransactionWindow(QDialog): label = unicode(self.label_edit.text()) self.parent.wallet.labels[self.tx_id] = label - super(TransactionWindow, self).accept() + super(TransactionWindow, self).accept() def __init__(self, transaction_id, parent): super(TransactionWindow, self).__init__() t@@ -210,7 +210,7 @@ class MiniWindow(QDialog): self.receiving = receiving_widget.ReceivingWidget(self) self.receiving.setObjectName("receiving") - # Add to the right side + # Add to the right side self.receiving_box = QGroupBox(_("Select a receiving address")) extra_layout = QGridLayout() t@@ -250,7 +250,7 @@ class MiniWindow(QDialog): self.show_history(show_hist) show_hist = self.config.get("gui_show_receiving",False) self.toggle_receiving_layout(show_hist) - + self.setWindowIcon(QIcon(":icons/electrum.png")) self.setWindowTitle("Electrum") self.setWindowFlags(Qt.Window|Qt.MSWindowsFixedSizeDialogHint) t@@ -384,7 +384,7 @@ class MiniWindow(QDialog): self.balance_label.show_balance() def create_quote_text(self, btc_balance): - """Return a string copy of the amount fiat currency the + """Return a string copy of the amount fiat currency the user has in bitcoins.""" from electrum.plugins import run_hook r = {} t@@ -443,7 +443,7 @@ class MiniWindow(QDialog): def update_completions(self, completions): self.address_completions.setStringList(completions) - + def update_history(self, tx_history): t@@ -499,7 +499,7 @@ class BalanceLabel(QLabel): position = event.globalPos() menu = self.parent.context_menu() menu.exec_(position) - + def set_balance_text(self, amount, unit, quote_text): """Set the amount of bitcoins in the gui.""" t@@ -560,7 +560,7 @@ class PasswordDialog(QDialog): main_layout.addLayout(grid) main_layout.addLayout(ok_cancel_buttons(self)) - self.setLayout(main_layout) + self.setLayout(main_layout) def run(self): if not self.exec_(): t@@ -599,10 +599,10 @@ class ReceivePopup(QDialog): self.show() class MiniActuator: - """Initialize the definitions relating to themes and + """Initialize the definitions relating to themes and sending/receiving bitcoins.""" - - + + def __init__(self, main_window): """Retrieve the gui theme used in previous session.""" self.g = main_window t@@ -624,7 +624,7 @@ class MiniActuator: def theme_names(self): """Sort themes.""" return sorted(self.themes.keys()) - + def selected_theme(self): """Select theme.""" return self.theme_name t@@ -634,14 +634,14 @@ class MiniActuator: self.theme_name = theme_name self.g.config.set_key('litegui_theme',theme_name) self.load_theme() - + def set_configured_exchange(self, set_exchange): use_exchange = self.g.config.get('use_exchange') if use_exchange is not None: set_exchange(use_exchange) - + def set_configured_currency(self, set_quote_currency): - """Set the inital fiat currency conversion country (USD/EUR/GBP) in + """Set the inital fiat currency conversion country (USD/EUR/GBP) in the GUI to what it was set to in the wallet.""" currency = self.g.config.get('currency') # currency can be none when Electrum is used for the first t@@ -694,7 +694,7 @@ class MiniActuator: dest_address = self.fetch_destination(address) if dest_address is None or not is_valid(dest_address): - QMessageBox.warning(parent_window, _('Error'), + QMessageBox.warning(parent_window, _('Error'), _('Invalid Bitcoin Address') + ':\n' + address, _('OK')) return False t@@ -726,7 +726,7 @@ class MiniActuator: h = self.g.wallet.send_tx(tx) self.waiting_dialog(lambda: False if self.g.wallet.tx_event.isSet() else _("Sending transaction, please wait...")) - + status, message = self.g.wallet.receive_tx(h, tx) if not status: t@@ -737,7 +737,7 @@ class MiniActuator: print "Dumped error tx to", dumpf.name QMessageBox.warning(parent_window, _('Error'), message, _('OK')) return False - + TransactionWindow(message, self) else: filename = 'unsigned_tx_%s' % (time.mktime(time.gmtime())) t@@ -760,10 +760,10 @@ class MiniActuator: # label or alias, with address in brackets match2 = re.match("(.*?)\s*\<([1-9A-HJ-NP-Za-km-z]{26,})\>", recipient) - + if match1: dest_address = \ - self.g.wallet.get_alias(recipient, True, + self.g.wallet.get_alias(recipient, True, self.show_message, self.question) return dest_address elif match2: t@@ -772,7 +772,7 @@ class MiniActuator: return recipient - + class MiniDriver(QObject): t@@ -872,4 +872,3 @@ if __name__ == "__main__": app.setStyleSheet(style_file.read()) mini = MiniWindow() sys.exit(app.exec_()) - DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py t@@ -762,7 +762,7 @@ class ElectrumWindow(QMainWindow): if not message and not amount: QMessageBox.warning(self, _('Error'), _('No message or amount'), _('OK')) return - self.receive_requests = self.wallet.storage.get('receive_requests',{}) + self.receive_requests = self.wallet.storage.get('receive_requests',{}) self.receive_requests[addr] = (amount, message) self.wallet.storage.put('receive_requests', self.receive_requests) self.update_receive_tab() t@@ -784,7 +784,7 @@ class ElectrumWindow(QMainWindow): self.receive_amount_e.setAmount(None) def clear_receive_tab(self): - self.receive_requests = self.wallet.storage.get('receive_requests',{}) + self.receive_requests = self.wallet.storage.get('receive_requests',{}) domain = self.wallet.get_account_addresses(self.current_account, include_change=False) for addr in domain: if not self.wallet.history.get(addr) and addr not in self.receive_requests.keys(): t@@ -818,7 +818,7 @@ class ElectrumWindow(QMainWindow): self.receive_address_e.setText(addr) def update_receive_tab(self): - self.receive_requests = self.wallet.storage.get('receive_requests',{}) + self.receive_requests = self.wallet.storage.get('receive_requests',{}) b = len(self.receive_requests) > 0 self.receive_list.setVisible(b) self.receive_requests_label.setVisible(b) t@@ -1566,7 +1566,7 @@ class ElectrumWindow(QMainWindow): self.payment_request_ok() else: self.payment_request_error() - + def create_invoice_menu(self, position): item = self.invoices_list.itemAt(position) t@@ -1616,11 +1616,11 @@ class ElectrumWindow(QMainWindow): name = _("Receiving") if not is_change else _("Change") seq_item = QTreeWidgetItem( [ name, '', '', '', ''] ) account_item.addChild(seq_item) - if not is_change: + if not is_change: seq_item.setExpanded(True) else: seq_item = account_item - + used_item = QTreeWidgetItem( [ _("Used"), '', '', '', ''] ) used_flag = False t@@ -1874,7 +1874,7 @@ class ElectrumWindow(QMainWindow): def show_qrcode(self, data, title = _("QR code")): - if not data: + if not data: return d = QRDialog(data, self, title) d.exec_() t@@ -2267,8 +2267,8 @@ class ElectrumWindow(QMainWindow): d.setMinimumSize(850, 300) vbox = QVBoxLayout(d) - msg = "%s\n%s\n%s" % (_("WARNING: ALL your private keys are secret."), - _("Exposing a single private key can compromise your entire wallet!"), + msg = "%s\n%s\n%s" % (_("WARNING: ALL your private keys are secret."), + _("Exposing a single private key can compromise your entire wallet!"), _("In particular, DO NOT use 'redeem private key' services proposed by third parties.")) vbox.addWidget(QLabel(msg)) t@@ -2291,7 +2291,7 @@ class ElectrumWindow(QMainWindow): def privkeys_thread(): for addr in addresses: time.sleep(0.1) - if done: + if done: break private_keys[addr] = "\n".join(self.wallet.get_private_key(addr, password)) d.emit(SIGNAL('computing_privkeys')) t@@ -2641,7 +2641,7 @@ class ElectrumWindow(QMainWindow): on_video_device = lambda x: self.config.set_key("video_device", str(qr_combo.itemData(x).toString()), True) qr_combo.currentIndexChanged.connect(on_video_device) widgets.append((qr_label, qr_combo, qr_help)) - + usechange_cb = QCheckBox(_('Use change addresses')) usechange_cb.setChecked(self.wallet.use_change) usechange_help = HelpButton(_('Using change addresses makes it more difficult for other people to track your transactions.')) t@@ -2671,7 +2671,7 @@ class ElectrumWindow(QMainWindow): for a,b,c in widgets: i = grid.rowCount() - if b: + if b: grid.addWidget(a, i, 0) grid.addWidget(b, i, 1) else: DIR diff --git a/gui/qt/network_dialog.py b/gui/qt/network_dialog.py t@@ -56,7 +56,7 @@ class NetworkDialog(QDialog): else: status = _("Not connected") if network.is_connected(): - status += "\n" + _("Server") + ": %s"%(host) + status += "\n" + _("Server") + ": %s"%(host) else: status += "\n" + _("Disconnected from server") else: t@@ -117,14 +117,14 @@ class NetworkDialog(QDialog): self.change_server(host, protocol) self.set_protocol(protocol) - self.servers_list_widget.connect(self.servers_list_widget, - SIGNAL('currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)'), + self.servers_list_widget.connect(self.servers_list_widget, + SIGNAL('currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)'), lambda x,y: self.server_changed(x)) grid.addWidget(self.servers_list_widget, 1, 1, 1, 3) if not config.is_modifiable('server'): for w in [self.server_host, self.server_port, self.server_protocol, self.servers_list_widget]: w.setEnabled(False) - + def enable_set_server(): enabled = not self.autocycle_cb.isChecked() self.server_host.setEnabled(enabled) t@@ -167,7 +167,7 @@ class NetworkDialog(QDialog): # buttons vbox.addLayout(ok_cancel_buttons(self)) - self.setLayout(vbox) + self.setLayout(vbox) def init_servers_list(self): t@@ -182,7 +182,7 @@ class NetworkDialog(QDialog): if protocol != self.protocol: self.protocol = protocol self.init_servers_list() - + def change_protocol(self, index): p = protocol_letters[index] host = unicode(self.server_host.text()) t@@ -195,7 +195,7 @@ class NetworkDialog(QDialog): self.set_protocol(p) def server_changed(self, x): - if x: + if x: self.change_server(str(x.text(0)), self.protocol) def change_server(self, host, protocol): t@@ -204,7 +204,7 @@ class NetworkDialog(QDialog): if protocol: port = pp.get(protocol) if not port: protocol = None - + if not protocol: if 's' in pp.keys(): protocol = 's' t@@ -212,7 +212,7 @@ class NetworkDialog(QDialog): else: protocol = pp.keys()[0] port = pp.get(protocol) - + self.server_host.setText( host ) self.server_port.setText( port ) self.server_protocol.setCurrentIndex(protocol_letters.index(protocol)) t@@ -237,8 +237,8 @@ class NetworkDialog(QDialog): protocol = protocol_letters[self.server_protocol.currentIndex()] if self.proxy_mode.currentText() != 'NONE': - proxy = { 'mode':str(self.proxy_mode.currentText()).lower(), - 'host':str(self.proxy_host.text()), + proxy = { 'mode':str(self.proxy_mode.currentText()).lower(), + 'host':str(self.proxy_host.text()), 'port':str(self.proxy_port.text()) } else: proxy = None DIR diff --git a/gui/qt/password_dialog.py b/gui/qt/password_dialog.py t@@ -33,7 +33,7 @@ def make_password_dialog(self, wallet, msg, new_pass=True): self.new_pw.setEchoMode(2) self.conf_pw = QLineEdit() self.conf_pw.setEchoMode(2) - + vbox = QVBoxLayout() label = QLabel(msg) label.setWordWrap(True) t@@ -56,7 +56,7 @@ def make_password_dialog(self, wallet, msg, new_pass=True): grid.setSpacing(8) grid.setColumnMinimumWidth(0, 250) grid.setColumnStretch(1,1) - + if wallet and wallet.use_encryption: grid.addWidget(QLabel(_('Password')), 0, 0) grid.addWidget(self.pw, 0, 1) t@@ -79,7 +79,7 @@ def make_password_dialog(self, wallet, msg, new_pass=True): def run_password_dialog(self, wallet, parent): - + if wallet and wallet.is_watching_only(): QMessageBox.information(parent, _('Error'), _('This is a watching-only wallet'), _('OK')) return False, None, None t@@ -173,7 +173,3 @@ class PasswordDialog(QDialog): QMessageBox.information(self.parent, _('Success'), _('Password was updated successfully'), _('OK')) else: QMessageBox.information(self.parent, _('Success'), _('This wallet is not encrypted'), _('OK')) - - - - DIR diff --git a/gui/qt/paytoedit.py b/gui/qt/paytoedit.py t@@ -122,7 +122,7 @@ class PayToEdit(QRTextEdit): except: self.errors.append((i, line.strip())) continue - + outputs.append((type, to_address, amount)) total += amount t@@ -189,7 +189,7 @@ class PayToEdit(QRTextEdit): tc.movePosition(QTextCursor.EndOfWord) tc.insertText(completion.right(extra)) self.setTextCursor(tc) - + def textUnderCursor(self): tc = self.textCursor() t@@ -235,4 +235,3 @@ class PayToEdit(QRTextEdit): cr = self.cursorRect() cr.setWidth(self.c.popup().sizeHintForColumn(0) + self.c.popup().verticalScrollBar().sizeHint().width()) self.c.complete(cr) - DIR diff --git a/gui/qt/qrcodewidget.py b/gui/qt/qrcodewidget.py t@@ -36,7 +36,7 @@ class QRCodeWidget(QWidget): self.qr = None self.update() - + def paintEvent(self, e): if not self.data: t@@ -83,7 +83,7 @@ class QRCodeWidget(QWidget): qp.setPen(white) qp.drawRect(left+c*boxsize, top+r*boxsize, boxsize, boxsize) qp.end() - + class QRDialog(QDialog): t@@ -132,4 +132,3 @@ class QRDialog(QDialog): vbox.addLayout(hbox) d.setLayout(vbox) - DIR diff --git a/gui/qt/qrwindow.py b/gui/qt/qrwindow.py t@@ -51,7 +51,7 @@ class QR_Window(QWidget): self.setFocusPolicy(QtCore.Qt.NoFocus) main_box = QHBoxLayout() - + self.qrw = QRCodeWidget() main_box.addWidget(self.qrw, 1) t@@ -84,7 +84,3 @@ class QR_Window(QWidget): label_text = "<span style='font-size: 21pt'>%s</span>" % message if message else "" self.label_label.setText(label_text) self.qrw.setData(url) - - - - DIR diff --git a/gui/qt/receiving_widget.py b/gui/qt/receiving_widget.py t@@ -22,7 +22,7 @@ class ReceivingWidget(QTreeWidget): self.editing = False def update_label(self, item, column): - if self.editing: + if self.editing: return else: address = str(item.text(0)) t@@ -32,7 +32,7 @@ class ReceivingWidget(QTreeWidget): def copy_address(self): address = self.currentItem().text(0) qApp.clipboard().setText(address) - + def update_list(self): return DIR diff --git a/gui/qt/seed_dialog.py b/gui/qt/seed_dialog.py t@@ -40,18 +40,18 @@ class SeedDialog(QDialog): def icon_filename(sid): if sid == 'cold': - return ":icons/cold_seed.png" + return ":icons/cold_seed.png" elif sid == 'hot': - return ":icons/hot_seed.png" + return ":icons/hot_seed.png" else: - return ":icons/seed.png" - + return ":icons/seed.png" + def show_seed_box(seed, sid=None): - save_msg = _("Please save these %d words on paper (order is important).")%len(seed.split()) + " " + save_msg = _("Please save these %d words on paper (order is important).")%len(seed.split()) + " " qr_msg = _("Your seed is also displayed as QR code, in case you want to transfer it to a mobile phone.") + "<p>" warning_msg = "<b>"+_("WARNING")+":</b> " + _("Never disclose your seed. Never type it on a website.") + "</b><p>" t@@ -60,12 +60,12 @@ def show_seed_box(seed, sid=None): msg2 = save_msg + " " \ + _("This seed will allow you to recover your wallet in case of computer failure.") + "<br/>" \ + warning_msg - + elif sid == 'cold': msg = _("Your cold storage seed is") msg2 = save_msg + " " \ + _("This seed will be permanently deleted from your wallet file. Make sure you have saved it before you press 'next'") + " " \ - + elif sid == 'hot': msg = _("Your hot seed is") msg2 = save_msg + " " \ t@@ -92,7 +92,7 @@ def show_seed_box(seed, sid=None): vbox.addLayout(grid) vbox.addWidget(label2) vbox.addStretch(1) - + return vbox DIR diff --git a/gui/qt/transaction_dialog.py b/gui/qt/transaction_dialog.py t@@ -45,7 +45,7 @@ class TxDialog(QDialog): tx_dict = tx.as_dict() self.parent = parent self.wallet = parent.wallet - + QDialog.__init__(self) self.setMinimumWidth(600) self.setWindowTitle(_("Transaction")) t@@ -102,7 +102,7 @@ class TxDialog(QDialog): buttons.insertWidget(1,b) run_hook('transaction_dialog', self) - + self.update() t@@ -175,9 +175,9 @@ class TxDialog(QDialog): if not self.wallet.up_to_date: return - if is_relevant: + if is_relevant: if is_mine: - if fee is not None: + if fee is not None: self.amount_label.setText(_("Amount sent:")+' %s'% self.parent.format_amount(v-fee) + ' ' + self.parent.base_unit()) self.fee_label.setText(_("Transaction fee")+': %s'% self.parent.format_amount(fee) + ' ' + self.parent.base_unit()) else: t@@ -219,11 +219,7 @@ class TxDialog(QDialog): o_text.setMaximumHeight(100) vbox.addWidget(o_text) - + def show_message(self, msg): QMessageBox.information(self, _('Message'), msg, _('OK')) - - - - DIR diff --git a/gui/qt/util.py b/gui/qt/util.py t@@ -182,7 +182,7 @@ def filename_field(parent, config, defaultname, select_msg): b2.setText(_("json")) vbox.addWidget(b1) vbox.addWidget(b2) - + hbox = QHBoxLayout() directory = config.get('io_dir', unicode(os.path.expanduser('~'))) DIR diff --git a/gui/qt/version_getter.py b/gui/qt/version_getter.py t@@ -30,7 +30,7 @@ class VersionGetter(threading.Thread): def __init__(self, label): threading.Thread.__init__(self) self.label = label - + def run(self): try: con = httplib.HTTPConnection('electrum.org', 80, timeout=5) t@@ -39,7 +39,7 @@ class VersionGetter(threading.Thread): except socket.error as msg: print_error("Could not retrieve version information") return - + if res.status == 200: latest_version = res.read() latest_version = latest_version.replace("\n","") t@@ -88,7 +88,7 @@ class UpdateLabel(QLabel): self.config.set_key("last_seen_version", "9.9.9", True) QMessageBox.information(self, _("Preference saved"), _("No more notifications about version updates will be shown.")) self.dialog.done(0) - + def open_website(self): webbrowser.open("http://electrum.org/download.html") self.dialog.done(0) t@@ -100,7 +100,7 @@ class UpdateLabel(QLabel): main_layout = QGridLayout() main_layout.addWidget(QLabel(_("A new version of Electrum is available:")+" " + self.latest_version), 0,0,1,3) - + ignore_version = QPushButton(_("Ignore this version")) ignore_version.clicked.connect(self.ignore_this_version) t@@ -117,7 +117,5 @@ class UpdateLabel(QLabel): dialog.setLayout(main_layout) self.dialog = dialog - - if not dialog.exec_(): return - + if not dialog.exec_(): return DIR diff --git a/lib/account.py b/lib/account.py t@@ -224,7 +224,7 @@ class OldAccount(Account): pk = number_to_string( secexp, generator_secp256k1.order() ) compressed = False return SecretToASecret( pk, compressed ) - + def get_private_key(self, sequence, wallet, password): seed = wallet.get_seed(password) t@@ -417,7 +417,3 @@ class BIP32_Account_2of3(BIP32_Account_2of2): def get_type(self): return _('Multisig 2 of 3') - - - - DIR diff --git a/lib/blockchain.py b/lib/blockchain.py t@@ -36,7 +36,7 @@ class Blockchain(threading.Thread): self.set_local_height() self.queue = Queue.Queue() - + def height(self): return self.local_height t@@ -68,7 +68,7 @@ class Blockchain(threading.Thread): i, header = result if not header: continue - + height = header.get('block_height') if height <= self.local_height: t@@ -83,10 +83,10 @@ class Blockchain(threading.Thread): chain = self.get_chain( i, header ) # skip that server if the result is not consistent - if not chain: + if not chain: print_error('e') continue - + # verify the chain if self.verify_chain( chain ): print_error("height:", height, i.server) t@@ -101,13 +101,13 @@ class Blockchain(threading.Thread): self.network.new_blockchain_height(height, i) - - + + def verify_chain(self, chain): first_header = chain[0] prev_header = self.read_header(first_header.get('block_height') -1) - + for header in chain: height = header.get('block_height') t@@ -133,7 +133,7 @@ class Blockchain(threading.Thread): height = index*2016 num = len(data)/80 - if index == 0: + if index == 0: previous_hash = ("0"*64) else: prev_header = self.read_header(index*2016-1) t@@ -152,12 +152,12 @@ class Blockchain(threading.Thread): assert int('0x'+_hash,16) < target previous_header = header - previous_hash = _hash + previous_hash = _hash self.save_chunk(index, data) print_error("validated chunk %d"%height) - + def header_to_string(self, res): s = int_to_hex(res.get('version'),4) \ t@@ -190,7 +190,7 @@ class Blockchain(threading.Thread): filename = self.path() if os.path.exists(filename): return - + try: import urllib, socket socket.setdefaulttimeout(30) t@@ -238,7 +238,7 @@ class Blockchain(threading.Thread): f.close() if len(h) == 80: h = self.header_from_string(h) - return h + return h def get_target(self, index, chain=None): t@@ -254,13 +254,13 @@ class Blockchain(threading.Thread): for h in chain: if h.get('block_height') == index*2016-1: last = h - + nActualTimespan = last.get('timestamp') - first.get('timestamp') nTargetTimespan = 14*24*60*60 nActualTimespan = max(nActualTimespan, nTargetTimespan/4) nActualTimespan = min(nActualTimespan, nTargetTimespan*4) - bits = last.get('bits') + bits = last.get('bits') # convert to bignum MM = 256*256*256 a = bits%MM t@@ -270,7 +270,7 @@ class Blockchain(threading.Thread): # new target new_target = min( max_target, (target * nActualTimespan)/nTargetTimespan ) - + # convert it to bits c = ("%064X"%new_target)[2:] i = 31 t@@ -279,7 +279,7 @@ class Blockchain(threading.Thread): i -= 1 c = int('0x'+c[0:6],16) - if c >= 0x800000: + if c >= 0x800000: c /= 256 i += 1 t@@ -357,4 +357,3 @@ class Blockchain(threading.Thread): return False return True - DIR diff --git a/lib/bmp.py b/lib/bmp.py t@@ -23,7 +23,7 @@ bmp.py - module for constructing simple BMP graphics files """ __version__ = "0.3" -__about = "bmp module, version %s, written by Paul McGuire, October, 2003, updated by Margus Laak, September, 2009" % __version__ +__about = "bmp module, version %s, written by Paul McGuire, October, 2003, updated by Margus Laak, September, 2009" % __version__ from math import ceil, hypot t@@ -51,7 +51,7 @@ class Color(object): """class for specifying colors while drawing BitMap elements""" __slots__ = [ 'red', 'grn', 'blu' ] __shade = 32 - + def __init__( self, r=0, g=0, b=0 ): self.red = r self.grn = g t@@ -65,32 +65,32 @@ class Color(object): def __str__( self ): return "R:%d G:%d B:%d" % (self.red, self.grn, self.blu ) - + def __hash__( self ): - return ( ( long(self.blu) ) + - ( long(self.grn) << 8 ) + + return ( ( long(self.blu) ) + + ( long(self.grn) << 8 ) + ( long(self.red) << 16 ) ) - + def __eq__( self, other ): return (self is other) or (self.toLong == other.toLong) def lighten( self ): - return Color( - min( self.red + Color.__shade, 255), - min( self.grn + Color.__shade, 255), - min( self.blu + Color.__shade, 255) + return Color( + min( self.red + Color.__shade, 255), + min( self.grn + Color.__shade, 255), + min( self.blu + Color.__shade, 255) ) - + def darken( self ): - return Color( - max( self.red - Color.__shade, 0), - max( self.grn - Color.__shade, 0), - max( self.blu - Color.__shade, 0) + return Color( + max( self.red - Color.__shade, 0), + max( self.grn - Color.__shade, 0), + max( self.blu - Color.__shade, 0) ) - + def toLong( self ): return self.__hash__() - + def fromLong( l ): b = l & 0xff l = l >> 8 t@@ -120,7 +120,7 @@ Color.GRAY = Color( 128, 128, 128 ) class BitMap(object): """class for drawing and saving simple Windows bitmap files""" - + LINE_SOLID = 0 LINE_DASHED = 1 LINE_DOTTED = 2 t@@ -128,8 +128,8 @@ class BitMap(object): _DASH_LEN = 12.0 _DOT_LEN = 6.0 _DOT_DASH_LEN = _DOT_LEN + _DASH_LEN - - def __init__( self, width, height, + + def __init__( self, width, height, bkgd = Color.WHITE, frgd = Color.BLACK ): self.wd = int( ceil(width) ) self.ht = int( ceil(height) ) t@@ -143,18 +143,18 @@ class BitMap(object): tmparray = [ self.bgcolor ] * self.wd self.bitarray = [ tmparray[:] for i in range( self.ht ) ] self.currentPen = 1 - + def plotPoint( self, x, y ): if ( 0 <= x < self.wd and 0 <= y < self.ht ): x = int(x) y = int(y) self.bitarray[y][x] = self.currentPen - + def _saveBitMapNoCompression( self ): line_padding = (4 - (self.wd % 4)) % 4 - + # write bitmap header _bitmap = "BM" _bitmap += longToString( 54 + self.ht*(self.wd*3 + line_padding) ) # DWORD size in bytes of the file t@@ -183,15 +183,15 @@ class BitMap(object): return _bitmap - - + + def saveFile( self, filename): _b = self._saveBitMapNoCompression( ) - + f = file(filename, 'wb') f.write(_b) f.close() - + def save_qrcode(qr, filename): matrix = qr.get_matrix() t@@ -211,12 +211,11 @@ def save_qrcode(qr, filename): bitmap.saveFile( filename ) - - + + if __name__ == "__main__": - + bmp = BitMap( 10, 10 ) bmp.plotPoint( 5, 5 ) bmp.plotPoint( 0, 0 ) bmp.saveFile( "test.bmp" ) - DIR diff --git a/lib/i18n.py b/lib/i18n.py t@@ -33,8 +33,8 @@ def _(x): def set_language(x): global language if x: language = gettext.translation('electrum', LOCALE_DIR, fallback = True, languages=[x]) - - + + languages = { '':_('Default'), 'pt_PT':_('Portuguese'), DIR diff --git a/lib/interface.py b/lib/interface.py t@@ -252,7 +252,7 @@ class TcpInterface(threading.Thread): os.rename(temporary_path, cert_path) return s - + def send_request(self, request, queue=None): _id = request.get('id') t@@ -273,7 +273,7 @@ class TcpInterface(threading.Thread): def parse_proxy_options(self, s): if type(s) == type({}): return s # fixme: type should be fixed - if type(s) != type(""): return None + if type(s) != type(""): return None if s.lower() == 'none': return None proxy = { "mode":"socks5", "host":"localhost" } args = s.split(':') t@@ -355,7 +355,7 @@ class HttpInterface(TcpInterface): def send_request(self, request, queue=None): import urllib2, json, time, cookielib print_error( "send_http", messages ) - + if self.proxy: socks.setdefaultproxy(self.proxy_mode, self.proxy["host"], int(self.proxy["port"]) ) socks.wrapmodule(urllib2) t@@ -380,9 +380,9 @@ class HttpInterface(TcpInterface): data_json = json.dumps(data) else: # poll with GET - data_json = None + data_json = None + - headers = {'content-type': 'application/json'} if self.session_id: headers['cookie'] = 'SESSION=%s'%self.session_id t@@ -399,17 +399,17 @@ class HttpInterface(TcpInterface): response = response_stream.read() self.bytes_received += len(response) - if response: + if response: response = json.loads( response ) if type(response) is not type([]): self.process_response(response) else: for item in response: self.process_response(item) - if response: + if response: self.poll_interval = 1 else: - if self.poll_interval < 15: + if self.poll_interval < 15: self.poll_interval += 1 #print self.poll_interval, response self.rtime = time.time() - t1 t@@ -454,7 +454,7 @@ class HttpInterface(TcpInterface): except Exception: traceback.print_exc(file=sys.stdout) break - + self.is_connected = False DIR diff --git a/lib/msqr.py b/lib/msqr.py t@@ -3,14 +3,14 @@ def modular_sqrt(a, p): """ Find a quadratic residue (mod p) of 'a'. p must be an odd prime. - + Solve the congruence of the form: x^2 = a (mod p) And returns x. Note that p - x is also a root. - + 0 is returned is no square root exists for these a and p. - + The Tonelli-Shanks algorithm is used (except for some simple cases in which the solution is known from an identity). This algorithm t@@ -27,7 +27,7 @@ def modular_sqrt(a, p): return p elif p % 4 == 3: return pow(a, (p + 1) / 4, p) - + # Partition p-1 to s * 2^e for an odd s (i.e. # reduce all the powers of 2 from p-1) # t@@ -36,20 +36,20 @@ def modular_sqrt(a, p): while s % 2 == 0: s /= 2 e += 1 - + # Find some 'n' with a legendre symbol n|p = -1. # Shouldn't take long. # n = 2 while legendre_symbol(n, p) != -1: n += 1 - + # Here be dragons! # Read the paper "Square roots from 1; 24, 51, # 10 to Dan Shanks" by Ezra Brown for more # information # - + # x is a guess of the square root that gets better # with each iteration. # b is the "fudge factor" - by how much we're off t@@ -63,7 +63,7 @@ def modular_sqrt(a, p): b = pow(a, s, p) g = pow(n, s, p) r = e - + while True: t = b m = 0 t@@ -71,22 +71,22 @@ def modular_sqrt(a, p): if t == 1: break t = pow(t, 2, p) - + if m == 0: return x - + gs = pow(g, 2 ** (r - m - 1), p) g = (gs * gs) % p x = (x * gs) % p b = (b * g) % p r = m - + def legendre_symbol(a, p): """ Compute the Legendre symbol a|p using Euler's criterion. p is a prime, a is relatively prime to p (if p divides a, then a|p = 0) - + Returns 1 if a has a square root modulo p, -1 otherwise. """ DIR diff --git a/lib/network.py b/lib/network.py t@@ -46,7 +46,7 @@ def parse_servers(result): elif re.match("p\d*", v): pruning_level = v[1:] if pruning_level == '': pruning_level = '0' - try: + try: is_recent = float(version)>=float(PROTOCOL_VERSION) except Exception: is_recent = False t@@ -65,7 +65,7 @@ def filter_protocol(servers, p): if p in protocols: l.append( ':'.join([k, protocols[p], p]) ) return l - + def pick_random_server(p='s'): return random.choice( filter_protocol(DEFAULT_SERVERS,p) ) t@@ -115,7 +115,7 @@ class Network(threading.Thread): os.mkdir(dir_path) # address subscriptions and cached results - self.addresses = {} + self.addresses = {} self.connection_status = 'connecting' self.requests_queue = Queue.Queue() t@@ -169,10 +169,10 @@ class Network(threading.Thread): continue else: choice_list.append(s) - - if not choice_list: + + if not choice_list: return - + server = random.choice( choice_list ) return server t@@ -187,7 +187,7 @@ class Network(threading.Thread): def get_servers(self): if self.irc_servers: - out = self.irc_servers + out = self.irc_servers else: out = DEFAULT_SERVERS for s in self.recent_servers: t@@ -213,7 +213,7 @@ class Network(threading.Thread): self.interface = self.start_interface(self.default_server) for i in range(self.num_server): self.start_random_interface() - + def start(self, response_queue): self.running = True self.response_queue = response_queue t@@ -269,7 +269,7 @@ class Network(threading.Thread): def stop_interface(self): - self.interface.stop() + self.interface.stop() def set_server(self, server): t@@ -293,7 +293,7 @@ class Network(threading.Thread): self.switch_to_interface( self.interfaces[server] ) else: self.interface = self.start_interface(server) - + def add_recent_server(self, i): # list is ordered t@@ -366,7 +366,7 @@ class Network(threading.Thread): if method == 'blockchain.address.subscribe': addr = params[0] if addr in self.addresses: - self.response_queue.put({'id':_id, 'result':self.addresses[addr]}) + self.response_queue.put({'id':_id, 'result':self.addresses[addr]}) return self.interface.send_request(request) t@@ -393,7 +393,7 @@ class Network(threading.Thread): self.disconnected_time = time.time() continue - + if response is not None: self.process_response(i, response) continue t@@ -484,5 +484,3 @@ class Network(threading.Thread): def get_local_height(self): return self.blockchain.height() - - DIR diff --git a/lib/network_proxy.py b/lib/network_proxy.py t@@ -89,7 +89,7 @@ class NetworkProxy(threading.Thread): print_error("NetworkProxy: terminating") def process(self, response): - if self.debug: + if self.debug: print_error("<--", response) if response.get('method') == 'network.status': t@@ -125,7 +125,7 @@ class NetworkProxy(threading.Thread): print_error( "received unexpected notification", method, params) return - + r = {'method':method, 'params':params, 'result':result, 'id':msg_id, 'error':error} callback(r) t@@ -141,7 +141,7 @@ class NetworkProxy(threading.Thread): sub.append(message) if sub: with self.lock: - if self.subscriptions.get(callback) is None: + if self.subscriptions.get(callback) is None: self.subscriptions[callback] = [] for message in sub: if message not in self.subscriptions[callback]: t@@ -151,12 +151,12 @@ class NetworkProxy(threading.Thread): requests = [] ids = [] for m in messages: - method, params = m + method, params = m request = { 'id':self.message_id, 'method':method, 'params':params } self.unanswered_requests[self.message_id] = method, params, callback ids.append(self.message_id) requests.append(request) - if self.debug: + if self.debug: print_error("-->", request) self.message_id += 1 t@@ -230,4 +230,3 @@ class NetworkProxy(threading.Thread): callbacks = self.callbacks.get(event,[])[:] if callbacks: [callback() for callback in callbacks] - DIR diff --git a/lib/paymentrequest.py b/lib/paymentrequest.py t@@ -157,7 +157,7 @@ class PaymentRequest: paymntreq = self.data if not paymntreq.signature: self.error = "No signature" - return + return cert = paymentrequest_pb2.X509Certificates() cert.ParseFromString(paymntreq.pki_data) t@@ -199,7 +199,7 @@ class PaymentRequest: prefixBytes = bytearray([0x30,0x31,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0x04,0x20]) verify = pubkey.verify(sig, prefixBytes + hashBytes) else: - self.error = "Algorithm not supported" + self.error = "Algorithm not supported" util.print_error(self.error, algo.getComponentByName('algorithm')) return t@@ -352,4 +352,3 @@ if __name__ == "__main__": tx = "blah" pr.send_ack(tx, refund_addr = "1vXAXUnGitimzinpXrqDWVU4tyAAQ34RA") - DIR diff --git a/lib/paymentrequest_pb2.py b/lib/paymentrequest_pb2.py t@@ -301,37 +301,37 @@ DESCRIPTOR.message_types_by_name['PaymentACK'] = _PAYMENTACK class Output(message.Message): __metaclass__ = reflection.GeneratedProtocolMessageType DESCRIPTOR = _OUTPUT - + # @@protoc_insertion_point(class_scope:payments.Output) class PaymentDetails(message.Message): __metaclass__ = reflection.GeneratedProtocolMessageType DESCRIPTOR = _PAYMENTDETAILS - + # @@protoc_insertion_point(class_scope:payments.PaymentDetails) class PaymentRequest(message.Message): __metaclass__ = reflection.GeneratedProtocolMessageType DESCRIPTOR = _PAYMENTREQUEST - + # @@protoc_insertion_point(class_scope:payments.PaymentRequest) class X509Certificates(message.Message): __metaclass__ = reflection.GeneratedProtocolMessageType DESCRIPTOR = _X509CERTIFICATES - + # @@protoc_insertion_point(class_scope:payments.X509Certificates) class Payment(message.Message): __metaclass__ = reflection.GeneratedProtocolMessageType DESCRIPTOR = _PAYMENT - + # @@protoc_insertion_point(class_scope:payments.Payment) class PaymentACK(message.Message): __metaclass__ = reflection.GeneratedProtocolMessageType DESCRIPTOR = _PAYMENTACK - + # @@protoc_insertion_point(class_scope:payments.PaymentACK) # @@protoc_insertion_point(module_scope) DIR diff --git a/lib/plugins.py b/lib/plugins.py t@@ -81,7 +81,7 @@ class BasePlugin: def requires_settings(self): return False - + def enable(self): self.set_enabled(True) return True t@@ -109,4 +109,3 @@ class BasePlugin: def settings_dialog(self): pass - DIR diff --git a/lib/qrscanner.py b/lib/qrscanner.py t@@ -26,7 +26,7 @@ def scan_qr(config): if str(r.type) != 'QRCODE': continue return r.data - + def _find_system_cameras(): device_root = "/sys/class/video4linux" DIR diff --git a/lib/ripemd.py b/lib/ripemd.py t@@ -51,27 +51,27 @@ class RIPEMD160: """Return a new RIPEMD160 object. An optional string argument may be provided; if present, this string will be automatically hashed.""" - + def __init__(self, arg=None): self.ctx = RMDContext() if arg: self.update(arg) self.dig = None - + def update(self, arg): - """update(arg)""" + """update(arg)""" RMD160Update(self.ctx, arg, len(arg)) self.dig = None - + def digest(self): - """digest()""" + """digest()""" if self.dig: return self.dig ctx = self.ctx.copy() self.dig = RMD160Final(self.ctx) self.ctx = ctx return self.dig - + def hexdigest(self): """hexdigest()""" dig = self.digest() t@@ -79,9 +79,9 @@ class RIPEMD160: for d in dig: hex_digest += '%02x' % ord(d) return hex_digest - + def copy(self): - """copy()""" + """copy()""" import copy return copy.deepcopy(self) t@@ -90,7 +90,7 @@ class RIPEMD160: def new(arg=None): """Return a new RIPEMD160 object. An optional string argument may be provided; if present, this string will be automatically - hashed.""" + hashed.""" return RIPEMD160(arg) t@@ -260,7 +260,7 @@ def RMD160Transform(state, block): #uint32 state[5], uchar block[64] b = state[1] c = state[2] d = state[3] - e = state[4] + e = state[4] #/* Parallel round 1 */ a, c = R(a, b, c, d, e, F4, KK0, 8, 5, x) t@@ -361,7 +361,7 @@ def RMD160Transform(state, block): #uint32 state[5], uchar block[64] def RMD160Update(ctx, inp, inplen): if type(inp) == str: inp = [ord(i)&0xff for i in inp] - + have = (ctx.count / 8) % 64 need = 64 - have ctx.count += 8 * inplen DIR diff --git a/lib/synchronizer.py b/lib/synchronizer.py t@@ -166,11 +166,11 @@ class WalletSynchronizer(threading.Thread): rs = requested_histories.pop(addr) if self.wallet.get_status(hist) != rs: raise Exception("error: status mismatch: %s"%addr) - + # store received history self.wallet.receive_history_callback(addr, hist) - # request transactions that we don't have + # request transactions that we don't have for tx_hash, tx_height in hist: if self.wallet.transactions.get(tx_hash) is None: if (tx_hash, tx_height) not in requested_tx and (tx_hash, tx_height) not in missing_tx: t@@ -192,6 +192,5 @@ class WalletSynchronizer(threading.Thread): if self.was_updated and not requested_tx: self.network.trigger_callback('updated') # Updated gets called too many times from other places as well; if we use that signal we get the notification three times - self.network.trigger_callback("new_transaction") + self.network.trigger_callback("new_transaction") self.was_updated = False - DIR diff --git a/lib/transaction.py b/lib/transaction.py t@@ -60,7 +60,7 @@ class BCDataStream(object): def seek_file(self, position): self.read_cursor = position - + def close_file(self): self.input.close() t@@ -319,7 +319,7 @@ def x_to_xpub(x_pubkey): xpub, s = BIP32_Account.parse_xpubkey(x_pubkey) return xpub - + def parse_xpub(x_pubkey): if x_pubkey[0:2] == 'ff': t@@ -439,7 +439,7 @@ def get_address_from_output_script(bytes): - + def parse_input(vds): d = {} t@@ -506,7 +506,7 @@ class Transaction: self.outputs = outputs self.locktime = locktime self.raw = None - + @classmethod def deserialize(klass, raw): self = klass([],[]) t@@ -520,7 +520,7 @@ class Transaction: self.outputs = map(lambda x: (x['type'], x['address'], x['value']), d['outputs']) self.locktime = d['lockTime'] - @classmethod + @classmethod def sweep(klass, privkeys, network, to_address, fee): inputs = [] for privkey in privkeys: t@@ -555,14 +555,14 @@ class Transaction: if num is None: num = n # supports only "2 of 2", and "2 of 3" transactions assert num <= n and n in [2,3] - + if num==2: s = '52' elif num == 3: s = '53' else: raise - + for k in public_keys: s += op_push(len(k)/2) s += k t@@ -811,7 +811,7 @@ class Transaction: def has_address(self, addr): found = False for txin in self.inputs: - if addr == txin.get('address'): + if addr == txin.get('address'): found = True break if addr in self.get_output_addresses(): t@@ -843,7 +843,7 @@ class Transaction: is_partial = True if not is_send: is_partial = False - + for addr, value in self.get_outputs(): v_out += value if addr in addresses: t@@ -899,7 +899,4 @@ class Transaction: sum += i["value"] * age priority = sum / size print_error(priority, threshold) - return priority < threshold - - - + return priority < threshold DIR diff --git a/lib/util.py b/lib/util.py t@@ -182,7 +182,7 @@ def parse_URI(uri): valid_address = bitcoin.is_address(address) pq = urlparse.parse_qs(u.query) - + for k, v in pq.items(): if len(v)!=1: raise Exception('Duplicate Key', k) t@@ -202,7 +202,7 @@ def parse_URI(uri): label = pq['label'][0] if 'r' in pq: request_url = pq['r'][0] - + if request_url != '': return address, amount, label, message, request_url t@@ -225,7 +225,7 @@ __builtin__.raw_input = raw_input def parse_json(message): n = message.find('\n') - if n==-1: + if n==-1: return None, message try: j = json.loads( message[0:n] ) t@@ -352,4 +352,3 @@ class QueuePipe: def send_all(self, requests): for request in requests: self.send(request) - DIR diff --git a/lib/wallet.py b/lib/wallet.py t@@ -216,7 +216,7 @@ class Abstract_Wallet(object): # inputs tx.add_pubkey_addresses(self.transactions) - # outputs of tx: inputs of tx2 + # outputs of tx: inputs of tx2 for type, x, v in tx.outputs: if type == 'pubkey': for tx2 in self.transactions.values(): t@@ -1444,7 +1444,7 @@ class NewWallet(BIP32_HD_Wallet, Mnemonic): class Wallet_2of2(BIP32_Wallet, Mnemonic): - # Wallet with multisig addresses. + # Wallet with multisig addresses. # Cannot create accounts root_name = "x1/" root_derivation = "m/44'/0'" t@@ -1590,7 +1590,7 @@ class OldWallet(Deterministic_Wallet): -wallet_types = [ +wallet_types = [ # category type description constructor ('standard', 'old', ("Old wallet"), OldWallet), ('standard', 'xpub', ("BIP32 Import"), BIP32_Simple_Wallet), DIR diff --git a/lib/x509.py b/lib/x509.py t@@ -81,16 +81,16 @@ class X509(tlslite.X509): 'DNS': set(), 'SRV': set(), 'URI': set(), - 'XMPPAddr': set(), + 'XMPPAddr': set(), 'OU': None,} - + # Extract the CommonName(s) from the cert. for rdnss in self.subject: for rdns in rdnss: for name in rdns: oid = name.getComponentByName('type') value = name.getComponentByName('value') - + if oid == COMMON_NAME: value = decoder.decode(value, asn1Spec=DirectoryString())[0] value = decode_str(value.getComponent()) t@@ -106,7 +106,7 @@ class X509(tlslite.X509): oid = extension.getComponentByName('extnID') if oid != SUBJECT_ALT_NAME: continue - + value = decoder.decode(extension.getComponentByName('extnValue'), asn1Spec=OctetString())[0] sa_names = decoder.decode(value, asn1Spec=SubjectAltName())[0] t@@ -120,10 +120,10 @@ class X509(tlslite.X509): results['URI'].add(value[5:]) elif name_type == 'otherName': name = name.getComponent() - + oid = name.getComponentByName('type-id') value = name.getComponentByName('value') - + if oid == XMPP_ADDR: value = decoder.decode(value, asn1Spec=UTF8String())[0] results['XMPPAddr'].add(decode_str(value))