tpython3: remove calls to unicode function - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 15642ec8de0330f378ec360f3e959cf3acfc076d DIR parent 033a5c6c91b79cbf60da9ce85198d8ae76521a3a HTML Author: ThomasV <thomasv@electrum.org> Date: Tue, 8 Aug 2017 11:12:44 +0200 python3: remove calls to unicode function Diffstat: M gui/kivy/uix/dialogs/installwizard… | 4 ++-- M gui/qt/installwizard.py | 6 +++--- M lib/mnemonic.py | 5 +---- M lib/storage.py | 6 ------ M lib/websockets.py | 2 +- 5 files changed, 7 insertions(+), 16 deletions(-) --- DIR diff --git a/gui/kivy/uix/dialogs/installwizard.py b/gui/kivy/uix/dialogs/installwizard.py t@@ -704,7 +704,7 @@ class AddXpubDialog(WizardDialog): def get_text(self): ti = self.ids.text_input - return unicode(ti.text).strip() + return ti.text.strip() def get_params(self, button): return (self.get_text(),) t@@ -715,7 +715,7 @@ class AddXpubDialog(WizardDialog): self.app.scan_qr(on_complete) def do_paste(self): - self.ids.text_input.text = test_xpub if is_test else unicode(self.app._clipboard.paste()) + self.ids.text_input.text = test_xpub if is_test else self.app._clipboard.paste() def do_clear(self): self.ids.text_input.text = '' DIR diff --git a/gui/qt/installwizard.py b/gui/qt/installwizard.py t@@ -176,7 +176,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard): wallet_folder = os.path.dirname(self.storage.path) def on_choose(): - path = unicode(QFileDialog.getOpenFileName(self, "Select your wallet file", wallet_folder)) + path = QFileDialog.getOpenFileName(self, "Select your wallet file", wallet_folder) if path: self.name_e.setText(path) t@@ -222,7 +222,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard): if not self.storage.file_exists(): break if self.storage.file_exists() and self.storage.is_encrypted(): - password = unicode(self.pw_e.text()) + password = self.pw_e.text() try: self.storage.decrypt(password) break t@@ -467,7 +467,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard): line = QLineEdit() line.setText(default) def f(text): - self.next_button.setEnabled(test(unicode(text))) + self.next_button.setEnabled(test(text)) line.textEdited.connect(f) vbox.addWidget(line) vbox.addWidget(WWLabel(warning)) DIR diff --git a/lib/mnemonic.py b/lib/mnemonic.py t@@ -86,10 +86,7 @@ def is_CJK(c): def normalize_text(seed): # normalize - if six.PY2: - seed = unicodedata.normalize('NFKD', unicode(seed)) - else: - seed = unicodedata.normalize('NFKD', str(seed)) + seed = unicodedata.normalize('NFKD', str(seed)) # lower seed = seed.lower() # remove accents DIR diff --git a/lib/storage.py b/lib/storage.py t@@ -85,12 +85,6 @@ class WalletStorage(PrintError): except Exception as e: raise IOError("Cannot read wallet file '%s'" % self.path) self.data = {} - # In old versions of Electrum labels were latin1 encoded, this fixes breakage. - for i, label in labels.items(): - try: - unicode(label) - except UnicodeDecodeError: - d['labels'][i] = unicode(label.decode('latin1')) for key, value in d.items(): try: json.dumps(key) DIR diff --git a/lib/websockets.py b/lib/websockets.py t@@ -114,7 +114,7 @@ class WsClientThread(util.DaemonThread): for ws, amount in l: if not ws.closed: if sum(result.values()) >=amount: - ws.sendMessage(unicode('paid')) + ws.sendMessage('paid')