<commit_before># -*- coding: utf-8 -*-
from binascii import hexlify
from binascii import unhexlify
from http import HTTPStatus
from string import Template
import distutils.spawn  # pylint: disable=import-error,no-name-in-module
import json
import os
import sys
import pdb
import requests
import shlex
import subprocess
import tempfile
import time
import traceback

from ethereum.tools._solidity import get_solidity

from raiden.tests.utils.tester_client import (
    tester_deploy_contract,
    BlockChainServiceTesterMock,
    NettingChannelTesterMock,
)
from raiden.utils import (
    get_contract_path,
    get_project_root,
    fix_tester_storage,
    address_encoder,
    address_decoder,
)
from raiden.blockchain.abi import contract_checksum
from raiden.transfer import channel, views
from raiden.transfer.state import CHANNEL_STATE_OPENED
from raiden.tests.utils.genesis import GENESIS_STUB
from raiden.tests.utils.tester import create_tester_chain
from raiden.network.utils import get_free_port
from raiden.connection_manager import ConnectionManager

# the smoketest will assert that a different endpoint got successfully registered
TEST_ENDPOINT = '9.9.9.9:9999'
TEST_PARTNER_ADDRESS = '2' * 40
TEST_DEPOSIT_AMOUNT = 5

RST_DATADIR = tempfile.mkdtemp()
os.environ['RST_DATADIR'] = RST_DATADIR

GENESIS_PATH = Template('$RST_DATADIR/genesis.json').substitute(os.environ)

# Environment variables in the command for datadir and ports allow customization.
# We use DEFAULT_ETH_COMMAND, unless '$RST_ETH_COMMAND' is defined (all environment variables
# specific to the raiden smoke test are prefixed 'RST_' for Raiden Smoke Test).
# For customization, set the environment variable to fit your client like this:
# RST_ETH_COMMAND="ethereum --rpc-port \$RST_RPC_PORT \
#        --data-dir \$RST_DATADIR" raiden smoketest
# FIXME: this does not work: the `init` phase is not customizable (gh issue #758)
DEFAULT_ETH_COMMAND = """
$RST_GETH_BINARY
    --nodiscover
    --nat none
    --port 0
    --ipcdisable
    --rpc
    --rpcaddr 127.0.0.1
    --rpcapi eth,net,web3
    --rpcport $RST_RPC_PORT
    --mine
    --etherbase 0
    --unlock 0
    --networkid 627
    --verbosity 3
    --datadir $RST_DATADIR
"""
RST_GETH_BINARY = distutils.spawn.find_executable('geth')
if not RST_GETH_BINARY:
    print('Error: unable to locate geth binary.\n'
          'Make sure it is installed and added to the PATH variable.')
    sys.exit(1)

if RST_GETH_BINARY is not None and 'RST_GETH_BINARY' not in os.environ:
    os.environ['RST_GETH_BINARY'] = RST_GETH_BINARY


TEST_ACCOUNT = {
    'version': 3,
    'crypto': {
        'ciphertext': '4d9fecf81ca312f7b1ee1bd57196e9c51737d461d7faa019f566834d4d3d4615',<commit_msg>Style fix<commit_after># -*- coding: utf-8 -*-
from binascii import hexlify
from binascii import unhexlify
from http import HTTPStatus
from string import Template
import distutils.spawn  # pylint: disable=import-error,no-name-in-module
import json
import os
import sys
import pdb
import requests
import shlex
import subprocess
import tempfile
import time
import traceback

from ethereum.tools._solidity import get_solidity

from raiden.tests.utils.tester_client import (
    tester_deploy_contract,
    BlockChainServiceTesterMock,
    NettingChannelTesterMock,
)
from raiden.utils import (
    get_contract_path,
    get_project_root,
    fix_tester_storage,
    address_encoder,
    address_decoder,
)
from raiden.blockchain.abi import contract_checksum
from raiden.transfer import channel, views
from raiden.transfer.state import CHANNEL_STATE_OPENED
from raiden.tests.utils.genesis import GENESIS_STUB
from raiden.tests.utils.tester import create_tester_chain
from raiden.network.utils import get_free_port
from raiden.connection_manager import ConnectionManager

# the smoketest will assert that a different endpoint got successfully registered
TEST_ENDPOINT = '9.9.9.9:9999'
TEST_PARTNER_ADDRESS = '2' * 40
TEST_DEPOSIT_AMOUNT = 5

RST_DATADIR = tempfile.mkdtemp()
os.environ['RST_DATADIR'] = RST_DATADIR

GENESIS_PATH = Template('$RST_DATADIR/genesis.json').substitute(os.environ)

# Environment variables in the command for datadir and ports allow customization.
# We use DEFAULT_ETH_COMMAND, unless '$RST_ETH_COMMAND' is defined (all environment variables
# specific to the raiden smoke test are prefixed 'RST_' for Raiden Smoke Test).
# For customization, set the environment variable to fit your client like this:
# RST_ETH_COMMAND="ethereum --rpc-port \$RST_RPC_PORT \
#        --data-dir \$RST_DATADIR" raiden smoketest
# FIXME: this does not work: the `init` phase is not customizable (gh issue #758)
DEFAULT_ETH_COMMAND = """
$RST_GETH_BINARY
    --nodiscover
    --nat none
    --port 0
    --ipcdisable
    --rpc
    --rpcaddr 127.0.0.1
    --rpcapi eth,net,web3
    --rpcport $RST_RPC_PORT
    --mine
    --etherbase 0
    --unlock 0
    --networkid 627
    --verbosity 3
    --datadir $RST_DATADIR
"""
RST_GETH_BINARY = distutils.spawn.find_executable('geth')
if not RST_GETH_BINARY:
    print(
        'Error: unable to locate geth binary.\n'
        'Make sure it is installed and added to the PATH variable.'
    )
    sys.exit(1)

if RST_GETH_BINARY is not None and 'RST_GETH_BINARY' not in os.environ:
    os.environ['RST_GETH_BINARY'] = RST_GETH_BINARY


TEST_ACCOUNT = {
    'version': 3,
    'crypto': {
        'ciphertext': '4d9fecf81ca312f7b1ee1bd57196e9c51737d461d7faa019f566834d4d3d4615',
{'fraction_non_alphanumeric': 0.08063328424153167, 'fraction_numerical': 0.026509572901325478, 'mean_word_length': 4.254352030947776, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2246129', 'n_tokens_mistral': 1903, 'n_tokens_neox': 1846, 'n_words': 497}