diff --git a/conftest.py b/conftest.py index 78f8f65..de4443d 100644 --- a/conftest.py +++ b/conftest.py @@ -1,6 +1,3 @@ -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * import pytest import os import time @@ -19,7 +16,7 @@ def local_command(command, bg=False, redirect=''): elif OS == 'Linux': command.extend(['>', '/dev/null', '2>&1']) else: - print("OS not recognised, quitting.") + print "OS not recognised, quitting." elif redirect: command.extend(['>', redirect]) diff --git a/jmbase/jmbase/__init__.py b/jmbase/jmbase/__init__.py index 91dbab6..240d925 100644 --- a/jmbase/jmbase/__init__.py +++ b/jmbase/jmbase/__init__.py @@ -1,6 +1,4 @@ -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * +from __future__ import print_function from .support import (get_log, chunks, debug_silence, debug_dump_object, joinmarket_alert, core_alert, get_password, _byteify, diff --git a/jmbase/jmbase/bigstring.py b/jmbase/jmbase/bigstring.py new file mode 100644 index 0000000..6198f8a --- /dev/null +++ b/jmbase/jmbase/bigstring.py @@ -0,0 +1,47 @@ +try: + from cStringIO import StringIO +except ImportError: #pragma: no cover + from StringIO import StringIO #pragma: no cover +from itertools import count +from twisted.protocols import amp + +CHUNK_MAX = 0xffff + +class BigString(amp.Argument): + """ + A byte-string amp.Argument with no 65,535 length limit. + + Each value for a key/value pair in an AMP box may not + exceed 65,535 bytes in length. So if we *really* want to + send potentially larger values, this class will implicitly + encode/decode them to/from an arbitrary additional + number of key/value pairs that are given automatic key + names by prefixing this Argument's key name to a counter. + """ + def fromBox(self, name, strings, objects, proto): + value = StringIO() + value.write(strings.get(name)) + for counter in count(2): + chunk = strings.get("%s.%d" % (name, counter)) + if chunk is None: + break + value.write(chunk) + objects[name] = self.buildvalue(value.getvalue()) + + def buildvalue(self, value): + return value + + def toBox(self, name, strings, objects, proto): + value = StringIO(self.fromvalue(objects[name])) + firstChunk = value.read(CHUNK_MAX) + strings[name] = firstChunk + counter = 2 + while True: + nextChunk = value.read(CHUNK_MAX) + if not nextChunk: + break + strings["%s.%d" % (name, counter)] = nextChunk + counter += 1 + + def fromvalue(self, value): + return value diff --git a/jmbase/jmbase/commands.py b/jmbase/jmbase/commands.py index 7da527b..d136dc2 100644 --- a/jmbase/jmbase/commands.py +++ b/jmbase/jmbase/commands.py @@ -1,19 +1,18 @@ -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * # noqa: F401 +from __future__ import print_function """ Commands defining client-server (daemon) messaging protocol (*not* Joinmarket p2p protocol). Used for AMP asynchronous messages. """ -from twisted.protocols.amp import Boolean, Command, Integer, Unicode +from twisted.protocols.amp import Boolean, Command, Integer, String +from bigstring import BigString class DaemonNotReady(Exception): pass class JMCommand(Command): #a default response type - response = [(b'accepted', Boolean())] + response = [('accepted', Boolean())] """COMMANDS FROM CLIENT TO DAEMON ================================= @@ -28,44 +27,44 @@ class JMInit(JMCommand): Blockchain source is communicated only as a naming tag for messagechannels (currently IRC 'realname' field). """ - arguments = [(b'bcsource', Unicode()), - (b'network', Unicode()), - (b'irc_configs', Unicode()), - (b'minmakers', Integer()), - (b'maker_timeout_sec', Integer())] - errors = {DaemonNotReady: b'daemon is not ready'} + arguments = [('bcsource', String()), + ('network', String()), + ('irc_configs', String()), + ('minmakers', Integer()), + ('maker_timeout_sec', Integer())] + errors = {DaemonNotReady: 'daemon is not ready'} class JMStartMC(JMCommand): """Will restart message channel connections if config has changed; otherwise will only change nym/nick on MCs. """ - arguments = [(b'nick', Unicode())] + arguments = [('nick', String())] class JMSetup(JMCommand): """Communicates which of "MAKER" or "TAKER" roles are to be taken by this client; for MAKER role, passes initial offers for announcement (for TAKER, this data is "none") """ - arguments = [(b'role', Unicode()), - (b'initdata', Unicode())] + arguments = [('role', String()), + ('initdata', String())] class JMMsgSignature(JMCommand): """A response to a request for a bitcoin signature on a message-channel layer message from the daemon """ - arguments = [(b'nick', Unicode()), - (b'cmd', Unicode()), - (b'msg_to_return', Unicode()), - (b'hostid', Unicode())] + arguments = [('nick', String()), + ('cmd', String()), + ('msg_to_return', String()), + ('hostid', String())] class JMMsgSignatureVerify(JMCommand): """A response to a request to verify the bitcoin signature of a message-channel layer message from the daemon """ - arguments = [(b'verif_result', Boolean()), - (b'nick', Unicode()), - (b'fullmsg', Unicode()), - (b'hostid', Unicode())] + arguments = [('verif_result', Boolean()), + ('nick', String()), + ('fullmsg', String()), + ('hostid', String())] """TAKER specific commands """ @@ -78,24 +77,24 @@ class JMRequestOffers(JMCommand): class JMFill(JMCommand): """Fill an offer/order """ - arguments = [(b'amount', Integer()), - (b'commitment', Unicode()), - (b'revelation', Unicode()), - (b'filled_offers', Unicode())] + arguments = [('amount', Integer()), + ('commitment', String()), + ('revelation', String()), + ('filled_offers', String())] class JMMakeTx(JMCommand): """Send a hex encoded raw bitcoin transaction to a set of counterparties """ - arguments = [(b'nick_list', Unicode()), - (b'txhex', Unicode())] + arguments = [('nick_list', String()), + ('txhex', String())] class JMPushTx(JMCommand): """Pass a raw hex transaction to a specific counterparty (maker) for pushing (anonymity feature in JM) """ - arguments = [(b'nick', Unicode()), - (b'txhex', Unicode())] + arguments = [('nick', String()), + ('txhex', String())] """MAKER specific commands """ @@ -105,27 +104,27 @@ class JMAnnounceOffers(JMCommand): to the daemon, along with new announcement and cancellation lists (deltas). """ - arguments = [(b'to_announce', Unicode()), - (b'to_cancel', Unicode()), - (b'offerlist', Unicode())] + arguments = [('to_announce', String()), + ('to_cancel', String()), + ('offerlist', String())] class JMIOAuth(JMCommand): """Send contents of !ioauth message after verifying Taker's auth message """ - arguments = [(b'nick', Unicode()), - (b'utxolist', Unicode()), - (b'pubkey', Unicode()), - (b'cjaddr', Unicode()), - (b'changeaddr', Unicode()), - (b'pubkeysig', Unicode())] + arguments = [('nick', String()), + ('utxolist', String()), + ('pubkey', String()), + ('cjaddr', String()), + ('changeaddr', String()), + ('pubkeysig', String())] class JMTXSigs(JMCommand): """Send signatures on the bitcoin transaction sent by TAKER """ - arguments = [(b'nick', Unicode()), - (b'sigs', Unicode())] + arguments = [('nick', String()), + ('sigs', String())] """COMMANDS FROM DAEMON TO CLIENT ================================= @@ -138,10 +137,10 @@ class JMInitProto(JMCommand): (that key being controlled by the client; the daemon knows nothing about bitcoin). """ - arguments = [(b'nick_hash_length', Integer()), - (b'nick_max_encoded', Integer()), - (b'joinmarket_nick_header', Unicode()), - (b'joinmarket_version', Integer())] + arguments = [('nick_hash_length', Integer()), + ('nick_max_encoded', Integer()), + ('joinmarket_nick_header', String()), + ('joinmarket_version', Integer())] class JMUp(JMCommand): """Used to signal readiness of message channels to client. @@ -158,46 +157,47 @@ class JMRequestMsgSig(JMCommand): """Request the client to sign a message-channel layer message with the bitcoin key for the nick """ - arguments = [(b'nick', Unicode()), - (b'cmd', Unicode()), - (b'msg', Unicode()), - (b'msg_to_be_signed', Unicode()), - (b'hostid', Unicode())] + arguments = [('nick', String()), + ('cmd', String()), + ('msg', String()), + ('msg_to_be_signed', String()), + ('hostid', String())] class JMRequestMsgSigVerify(JMCommand): """Request the client to verify a counterparty's message-channel layer message against the provided nick """ - arguments = [(b'msg', Unicode()), - (b'fullmsg', Unicode()), - (b'sig', Unicode()), - (b'pubkey', Unicode()), - (b'nick', Unicode()), - (b'hashlen', Integer()), - (b'max_encoded', Integer()), - (b'hostid', Unicode())] + arguments = [('msg', String()), + ('fullmsg', String()), + ('sig', String()), + ('pubkey', String()), + ('nick', String()), + ('hashlen', Integer()), + ('max_encoded', Integer()), + ('hostid', String())] """ TAKER-specific commands """ class JMOffers(JMCommand): """Return the entire contents of the - orderbook to TAKER, as a json-ified dict. + orderbook to TAKER, as a json-ified dict; + note uses BigString because can be very large """ - arguments = [(b'orderbook', Unicode())] + arguments = [('orderbook', BigString())] class JMFillResponse(JMCommand): """Returns ioauth data from MAKER if successful. """ - arguments = [(b'success', Boolean()), - (b'ioauth_data', Unicode())] + arguments = [('success', Boolean()), + ('ioauth_data', String())] class JMSigReceived(JMCommand): """Returns an individual bitcoin transaction signature from a MAKER """ - arguments = [(b'nick', Unicode()), - (b'sig', Unicode())] + arguments = [('nick', String()), + ('sig', String())] """MAKER-specific commands """ @@ -208,17 +208,17 @@ class JMAuthReceived(JMCommand): allowing the MAKER to verify against btc library before setting up encryption and continuing. """ - arguments = [(b'nick', Unicode()), - (b'offer', Unicode()), - (b'commitment', Unicode()), - (b'revelation', Unicode()), - (b'amount', Integer()), - (b'kphex', Unicode())] + arguments = [('nick', String()), + ('offer', String()), + ('commitment', String()), + ('revelation', String()), + ('amount', Integer()), + ('kphex', String())] class JMTXReceived(JMCommand): """Send back transaction template provided by TAKER, along with offerdata to verify fees. """ - arguments = [(b'nick', Unicode()), - (b'txhex', Unicode()), - (b'offer', Unicode())] + arguments = [('nick', String()), + ('txhex', String()), + ('offer', String())] diff --git a/jmbase/jmbase/support.py b/jmbase/jmbase/support.py index 0109ce2..647afe0 100644 --- a/jmbase/jmbase/support.py +++ b/jmbase/jmbase/support.py @@ -1,6 +1,4 @@ -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * # noqa: F401 +from __future__ import absolute_import, print_function import sys @@ -50,7 +48,7 @@ def set_logging_level(level): consoleHandler.setLevel(level) def chunks(d, n): - return [d[x:x + n] for x in range(0, len(d), n)] + return [d[x:x + n] for x in xrange(0, len(d), n)] def get_password(msg): #pragma: no cover return getpass(msg) diff --git a/jmbase/setup.py b/jmbase/setup.py index 94add10..94db0ae 100644 --- a/jmbase/setup.py +++ b/jmbase/setup.py @@ -9,5 +9,5 @@ setup(name='joinmarketbase', author_email='', license='GPL', packages=['jmbase'], - install_requires=['future', 'twisted==18.9.0', 'service-identity'], + install_requires=['twisted==18.9.0', 'service-identity'], zip_safe=False) diff --git a/jmbase/test/test_base_support.py b/jmbase/test/test_base_support.py index aaeb9ea..5a53083 100644 --- a/jmbase/test/test_base_support.py +++ b/jmbase/test/test_base_support.py @@ -1,7 +1,5 @@ #! /usr/bin/env python -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * # noqa: F401 +from __future__ import print_function from jmbase.support import debug_dump_object, joinmarket_alert def test_debug_dump_object(): diff --git a/jmbase/test/test_commands.py b/jmbase/test/test_commands.py index 7bde889..cb71744 100644 --- a/jmbase/test/test_commands.py +++ b/jmbase/test/test_commands.py @@ -1,7 +1,5 @@ #! /usr/bin/env python -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * +from __future__ import print_function from twisted.internet import protocol, reactor, task from twisted.internet.error import (ConnectionLost, ConnectionAborted, ConnectionClosed, ConnectionDone) diff --git a/jmbitcoin/setup.py b/jmbitcoin/setup.py index f270c2e..fb76c0b 100644 --- a/jmbitcoin/setup.py +++ b/jmbitcoin/setup.py @@ -9,5 +9,5 @@ setup(name='joinmarketbitcoin', author_email='', license='GPL', packages=['jmbitcoin'], - install_requires=['future', 'secp256k1',], + install_requires=['secp256k1',], zip_safe=False) diff --git a/jmclient/setup.py b/jmclient/setup.py index 9b4a4f4..894881c 100644 --- a/jmclient/setup.py +++ b/jmclient/setup.py @@ -9,5 +9,5 @@ setup(name='joinmarketclient', author_email='', license='GPL', packages=['jmclient'], - install_requires=['future', 'joinmarketbase==0.4.1', 'mnemonic', 'qt4reactor', 'argon2_cffi', 'bencoder.pyx', 'pyaes'], + install_requires=['joinmarketbase==0.4.1', 'mnemonic', 'qt4reactor', 'argon2_cffi', 'bencoder.pyx', 'pyaes'], zip_safe=False) diff --git a/jmdaemon/jmdaemon/__init__.py b/jmdaemon/jmdaemon/__init__.py index 996fcbc..a08a7be 100644 --- a/jmdaemon/jmdaemon/__init__.py +++ b/jmdaemon/jmdaemon/__init__.py @@ -1,9 +1,7 @@ -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * +from __future__ import print_function import logging -from .protocol import * +from protocol import * from .enc_wrapper import as_init_encryption, decode_decrypt, \ encrypt_encode, init_keypair, init_pubkey, get_pubkey, NaclError from .irc import IRCMessageChannel diff --git a/jmdaemon/jmdaemon/daemon_protocol.py b/jmdaemon/jmdaemon/daemon_protocol.py index 5b2cc4c..4879695 100644 --- a/jmdaemon/jmdaemon/daemon_protocol.py +++ b/jmdaemon/jmdaemon/daemon_protocol.py @@ -1,7 +1,5 @@ #! /usr/bin/env python -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * +from __future__ import print_function from .message_channel import MessageChannelCollection from .orderbookwatch import OrderbookWatch @@ -294,7 +292,7 @@ class JMDaemonServerProtocol(amp.AMP, OrderbookWatch): are stored in the active_orders dict keyed by the nick of the Taker. """ nick, utxolist, pubkey, cjaddr, changeaddr, pubkeysig = [_byteify( - x) for x in (nick, utxolist, pubkey, cjaddr, changeaddr, pubkeysig)] + x) for x in nick, utxolist, pubkey, cjaddr, changeaddr, pubkeysig] if not self.role == "MAKER": return if not nick in self.active_orders: diff --git a/jmdaemon/jmdaemon/enc_wrapper.py b/jmdaemon/jmdaemon/enc_wrapper.py index 4866605..06fc8c5 100644 --- a/jmdaemon/jmdaemon/enc_wrapper.py +++ b/jmdaemon/jmdaemon/enc_wrapper.py @@ -1,6 +1,4 @@ -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * # noqa: F401 +from __future__ import absolute_import, print_function # A wrapper for public key # authenticated encryption diff --git a/jmdaemon/jmdaemon/irc.py b/jmdaemon/jmdaemon/irc.py index 968ecc3..9307d44 100644 --- a/jmdaemon/jmdaemon/irc.py +++ b/jmdaemon/jmdaemon/irc.py @@ -1,6 +1,4 @@ -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * +from __future__ import absolute_import, print_function #TODO: SSL support (can it be done without back-end openssl?) from twisted.internet import reactor, protocol diff --git a/jmdaemon/jmdaemon/message_channel.py b/jmdaemon/jmdaemon/message_channel.py index 62471aa..8866a15 100644 --- a/jmdaemon/jmdaemon/message_channel.py +++ b/jmdaemon/jmdaemon/message_channel.py @@ -1,7 +1,5 @@ #! /usr/bin/env python -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * # noqa: F401 +from __future__ import print_function import abc import base64 import threading @@ -14,7 +12,7 @@ from functools import wraps log = get_log() -class CJPeerError(Exception): +class CJPeerError(StandardError): pass diff --git a/jmdaemon/jmdaemon/orderbookwatch.py b/jmdaemon/jmdaemon/orderbookwatch.py index 233e464..871fed8 100644 --- a/jmdaemon/jmdaemon/orderbookwatch.py +++ b/jmdaemon/jmdaemon/orderbookwatch.py @@ -1,7 +1,5 @@ #! /usr/bin/env python -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * # noqa: F401 +from __future__ import absolute_import, print_function import sqlite3 import sys @@ -46,7 +44,7 @@ class OrderbookWatch(object): min_version = int(params[0]) max_version = int(params[1]) alert = msg[msg.index(params[1]) + len(params[1]):].strip() - except (ValueError, IndexError): + except ValueError, IndexError: continue if min_version < JM_VERSION < max_version: print('=' * 60) diff --git a/jmdaemon/jmdaemon/protocol.py b/jmdaemon/jmdaemon/protocol.py index 0532cc5..622969b 100644 --- a/jmdaemon/jmdaemon/protocol.py +++ b/jmdaemon/jmdaemon/protocol.py @@ -1,6 +1,3 @@ -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * # noqa: F401 #Protocol version JM_VERSION = 5 @@ -19,8 +16,8 @@ offertypes = {"reloffer": [(int, "oid"), (int, "minsize"), (int, "maxsize"), offername_list = offertypes.keys() -ORDER_KEYS = [b'counterparty', b'oid', b'ordertype', b'minsize', b'maxsize', b'txfee', - b'cjfee'] +ORDER_KEYS = ['counterparty', 'oid', 'ordertype', 'minsize', 'maxsize', 'txfee', + 'cjfee'] COMMAND_PREFIX = '!' JOINMARKET_NICK_HEADER = 'J' @@ -36,5 +33,5 @@ commitment_broadcast_list = ["hp2"] plaintext_commands += offername_list plaintext_commands += commitment_broadcast_list public_commands = commitment_broadcast_list + ["orderbook", "cancel" - ] + list(offername_list) + ] + offername_list private_commands = encrypted_commands + plaintext_commands diff --git a/jmdaemon/jmdaemon/socks.py b/jmdaemon/jmdaemon/socks.py index 9b5d248..8160b18 100644 --- a/jmdaemon/jmdaemon/socks.py +++ b/jmdaemon/jmdaemon/socks.py @@ -29,9 +29,7 @@ This module provides a standard socket-like interface for Python for tunneling connections through SOCKS proxies. """ -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * # noqa: F401 + import socket import struct import random diff --git a/jmdaemon/setup.py b/jmdaemon/setup.py index 3394920..b62d4f7 100644 --- a/jmdaemon/setup.py +++ b/jmdaemon/setup.py @@ -9,5 +9,5 @@ setup(name='joinmarketdaemon', author_email='', license='GPL', packages=['jmdaemon'], - install_requires=['future', 'txtorcon', 'pyopenssl', 'libnacl', 'joinmarketbase==0.4.1'], + install_requires=['txtorcon', 'pyopenssl', 'libnacl', 'joinmarketbase==0.4.1'], zip_safe=False) diff --git a/jmdaemon/test/dummy_mc.py b/jmdaemon/test/dummy_mc.py index a894d89..5394c50 100644 --- a/jmdaemon/test/dummy_mc.py +++ b/jmdaemon/test/dummy_mc.py @@ -1,6 +1,4 @@ -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * +from __future__ import absolute_import, print_function import time diff --git a/jmdaemon/test/msgdata.py b/jmdaemon/test/msgdata.py index 7d68aec..0b3dc67 100644 --- a/jmdaemon/test/msgdata.py +++ b/jmdaemon/test/msgdata.py @@ -1,6 +1,3 @@ -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * # noqa: F401 #orderbook t_orderbook = [{u'counterparty': u'J5FA1Gj7Ln4vSGne', u'ordertype': u'reloffer', u'oid': 0, u'minsize': 7500000, u'txfee': 1000, u'maxsize': 599972700, u'cjfee': u'0.0002'}, diff --git a/jmdaemon/test/test_daemon_protocol.py b/jmdaemon/test/test_daemon_protocol.py index 2ea57ca..285304d 100644 --- a/jmdaemon/test/test_daemon_protocol.py +++ b/jmdaemon/test/test_daemon_protocol.py @@ -1,7 +1,5 @@ #! /usr/bin/env python -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * +from __future__ import absolute_import '''test daemon-protocol interfacae.''' from jmdaemon import MessageChannelCollection diff --git a/jmdaemon/test/test_enc_wrapper.py b/jmdaemon/test/test_enc_wrapper.py index ef39b93..58a1b98 100644 --- a/jmdaemon/test/test_enc_wrapper.py +++ b/jmdaemon/test/test_enc_wrapper.py @@ -1,6 +1,3 @@ -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * # noqa: F401 import base64 import string import random @@ -14,37 +11,37 @@ from jmdaemon import (init_keypair, get_pubkey, init_pubkey, as_init_encryption, @pytest.mark.parametrize("ab_message,ba_message,num_iterations", [ # short ascii - (b"Attack at dawn", b"Not tonight Josephine!", 5), + ("Attack at dawn", "Not tonight Josephine!", 5), # long base64 encoded (base64.b64encode(''.join(random.choice( - string.ascii_letters) for _ in range(5000))), + string.ascii_letters) for _ in xrange(5000))), base64.b64encode(''.join(random.choice( - string.ascii_letters) for _ in range(5000))), + string.ascii_letters) for _ in xrange(5000))), 5,), # large number of messages on the same connection - (b'rand', b'rand', 40000), + ('rand', 'rand', 40000), # 1 character - (b'\x00', b'\x00', 5), + ('\x00', '\x00', 5), ]) def test_enc_wrapper(alice_bob_boxes, ab_message, ba_message, num_iterations): alice_box, bob_box = alice_bob_boxes for i in range(num_iterations): - ab_message = (''.join( + ab_message = ''.join( random.choice(string.ascii_letters) - for x in range(100))).encode('ascii') if ab_message == b'rand' else ab_message - ba_message = (''.join( + for x in range(100)) if ab_message == 'rand' else ab_message + ba_message = ''.join( random.choice(string.ascii_letters) - for x in range(100))).encode('ascii') if ba_message == b'rand' else ba_message + for x in range(100)) if ba_message == 'rand' else ba_message otw_amsg = alice_box.encrypt(ab_message) bob_ptext = bob_box.decrypt(otw_amsg) - assert bob_ptext == ab_message, "Encryption test: FAILED. Alice sent: {}, Bob received: {}".format( + assert bob_ptext == ab_message, "Encryption test: FAILED. Alice sent: %s, Bob received: " % ( ab_message, bob_ptext) otw_bmsg = bob_box.encrypt(ba_message) alice_ptext = alice_box.decrypt(otw_bmsg) - assert alice_ptext == ba_message, "Encryption test: FAILED. Bob sent: {}, Alice received: {}".format( + assert alice_ptext == ba_message, "Encryption test: FAILED. Bob sent: %s, Alice received: " % ( ba_message, alice_ptext) assert decode_decrypt(encrypt_encode(ab_message, bob_box), bob_box) == ab_message diff --git a/jmdaemon/test/test_irc_messaging.py b/jmdaemon/test/test_irc_messaging.py index 468d527..6b5257a 100644 --- a/jmdaemon/test/test_irc_messaging.py +++ b/jmdaemon/test/test_irc_messaging.py @@ -1,7 +1,5 @@ #! /usr/bin/env python -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * # noqa: F401 +from __future__ import absolute_import '''Tests of joinmarket bots end-to-end (including IRC and bitcoin) ''' import time @@ -43,7 +41,7 @@ def on_order_seen(dummy, counterparty, oid, ordertype, minsize, yg_name = counterparty def on_pubkey(pubkey): - print("received pubkey: " + pubkey) + print "received pubkey: " + pubkey def junk_pubmsgs(mc): #start a raw IRCMessageChannel instance in a thread; diff --git a/jmdaemon/test/test_message_channel.py b/jmdaemon/test/test_message_channel.py index 15f41b5..37a4d47 100644 --- a/jmdaemon/test/test_message_channel.py +++ b/jmdaemon/test/test_message_channel.py @@ -1,7 +1,5 @@ #! /usr/bin/env python -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * +from __future__ import absolute_import '''test messagechannel management code.''' import pytest @@ -78,9 +76,9 @@ def don_error(): def don_ioauth(nick, utxo_list, auth_pub, cj_addr, change_addr, btc_sig): jlog.debug("onioauth callback") - jlog.debug("Args are: " + ",".join([str(x) for x in (nick, + jlog.debug("Args are: " + ",".join([str(x) for x in nick, utxo_list, auth_pub, cj_addr, - change_addr, btc_sig)])) + change_addr, btc_sig])) def don_sig(nick, sig): jlog.debug("calledback on-sig") diff --git a/jmdaemon/test/test_orderbookwatch.py b/jmdaemon/test/test_orderbookwatch.py index f292449..4caba2f 100644 --- a/jmdaemon/test/test_orderbookwatch.py +++ b/jmdaemon/test/test_orderbookwatch.py @@ -1,7 +1,5 @@ #!/usr/bin/env python -from __future__ import (absolute_import, division, - print_function, unicode_literals) -from builtins import * # noqa: F401 +from __future__ import print_function import pytest