<commit_before>#! /usr/bin/env python3
"""
Counterparty setup script - works under Ubuntu Linux and Windows at the present moment
"""
import os
import sys
import getopt
import logging
import shutil
import zipfile
import platform
import tempfile
import subprocess
import stat
import string
import random
import tarfile
import urllib
import urllib.request

try: #ignore import errors on windows
    import pwd
    import grp
except ImportError:
    pass

from setup_util import *

PYTHON3_VER = None
DEFAULT_CONFIG = "[Default]\nbackend-rpc-connect=localhost\nbackend-rpc-port=8332\nbackend-rpc-user=rpc\nbackend-rpc-password=<PASSWORD>\nrpc-host=localhost\nrpc-port=4000\nrpc-user=rpc\nrpc-password=<PASSWORD>"
DEFAULT_CONFIG_TESTNET = "[Default]\nbackend-rpc-connect=localhost\nbackend-rpc-port=18332\nbackend-rpc-user=rpc\nbackend-rpc-password=<PASSWORD>\nrpc-host=localhost\nrpc-port=14000\nrpc-user=rpc\nrpc-password=<PASSWORD>\ntestnet=1"
DEFAULT_CONFIG_COUNTERBLOCKD = "[Default]\nbackend-rpc-connect=localhost\nbackend-rpc-port=8332\nbackend-rpc-user=rpc\nbackend-rpc-password=<PASSWORD>\ncounterpartyd-rpc-host=localhost\ncounterpartyd-rpc-port=4000\ncounterpartyd-rpc-user=rpc\ncounterpartyd-rpc-password=<PASSWORD>\nrpc-host=0.0.0.0\nsocketio-host=0.0.0.0\nsocketio-chat-host=0.0.0.0\nredis-enable-apicache=0"
DEFAULT_CONFIG_COUNTERBLOCKD_TESTNET = "[Default]\nbackend-rpc-connect=localhost\nbackend-rpc-port=18332\nbackend-rpc-user=rpc\nbackend-rpc-password=<PASSWORD>\ncounterpartyd-rpc-host=localhost\ncounterpartyd-rpc-port=14000\ncounterpartyd-rpc-user=rpc\ncounterpartyd-rpc-password=<PASSWORD>4\nrpc-host=0.0.0.0\nsocketio-host=0.0.0.0\nsocketio-chat-host=0.0.0.0\nredis-enable-apicache=0\ntestnet=1"

def _get_app_cfg_paths(appname, run_as_user):
    import appdirs #installed earlier
    cfg_path = os.path.join(
        appdirs.user_data_dir(appauthor='Counterparty', appname=appname, roaming=True) \
            if os.name == "nt" else ("%s/.config/%s" % (os.path.expanduser("~%s" % run_as_user), appname)), 
        "%s.conf" % appname.replace('-testnet', ''))
    data_dir = os.path.dirname(cfg_path)
    return (data_dir, cfg_path)

def do_prerun_checks():
    #make sure this is running on a supported OS
    if os.name not in ("nt", "posix"):
        logging.error("Build script only supports Linux or Windows at this time")
        sys.exit(1)
    if os.name == "posix" and platform.dist()[0] != "Ubuntu":<commit_msg>Make config files more readable when "cat"<commit_after>#! /usr/bin/env python3
"""
Counterparty setup script - works under Ubuntu Linux and Windows at the present moment
"""
import os
import sys
import getopt
import logging
import shutil
import zipfile
import platform
import tempfile
import subprocess
import stat
import string
import random
import tarfile
import urllib
import urllib.request

try: #ignore import errors on windows
    import pwd
    import grp
except ImportError:
    pass

from setup_util import *

PYTHON3_VER = None
DEFAULT_CONFIG = "[Default]\nbackend-rpc-connect=localhost\nbackend-rpc-port=8332\nbackend-rpc-user=rpc\nbackend-rpc-password=<PASSWORD>\nrpc-host=localhost\nrpc-port=4000\nrpc-user=rpc\nrpc-password=<PASSWORD>\n"
DEFAULT_CONFIG_TESTNET = "[Default]\nbackend-rpc-connect=localhost\nbackend-rpc-port=18332\nbackend-rpc-user=rpc\nbackend-rpc-password=<PASSWORD>\nrpc-host=localhost\nrpc-port=14000\nrpc-user=rpc\nrpc-password=<PASSWORD>\ntestnet=1\n"
DEFAULT_CONFIG_COUNTERBLOCKD = "[Default]\nbackend-rpc-connect=localhost\nbackend-rpc-port=8332\nbackend-rpc-user=rpc\nbackend-rpc-password=<PASSWORD>\ncounterpartyd-rpc-host=localhost\ncounterpartyd-rpc-port=4000\ncounterpartyd-rpc-user=rpc\ncounterpartyd-rpc-password=<PASSWORD>\nrpc-host=0.0.0.0\nsocketio-host=0.0.0.0\nsocketio-chat-host=0.0.0.0\nredis-enable-apicache=0\n"
DEFAULT_CONFIG_COUNTERBLOCKD_TESTNET = "[Default]\nbackend-rpc-connect=localhost\nbackend-rpc-port=18332\nbackend-rpc-user=rpc\nbackend-rpc-password=<PASSWORD>\ncounterpartyd-rpc-host=localhost\ncounterpartyd-rpc-port=14000\ncounterpartyd-rpc-user=rpc\ncounterpartyd-rpc-password=<PASSWORD>\nrpc-host=0.0.0.0\nsocketio-host=0.0.0.0\nsocketio-chat-host=0.0.0.0\nredis-enable-apicache=0\ntestnet=1\n"

def _get_app_cfg_paths(appname, run_as_user):
    import appdirs #installed earlier
    cfg_path = os.path.join(
        appdirs.user_data_dir(appauthor='Counterparty', appname=appname, roaming=True) \
            if os.name == "nt" else ("%s/.config/%s" % (os.path.expanduser("~%s" % run_as_user), appname)), 
        "%s.conf" % appname.replace('-testnet', ''))
    data_dir = os.path.dirname(cfg_path)
    return (data_dir, cfg_path)

def do_prerun_checks():
    #make sure this is running on a supported OS
    if os.name not in ("nt", "posix"):
        logging.error("Build script only supports Linux or Windows at this time")
        sys.exit(1)
    if os.name == "posix" and platform.dist()[0] != "Ubuntu":
{'fraction_non_alphanumeric': 0.13693620479479887, 'fraction_numerical': 0.02783421373425437, 'mean_word_length': 5.16145181476846, 'pattern_counts': {'":': 2, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 12, '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': '6897470', 'n_tokens_mistral': 1820, 'n_tokens_neox': 1758, 'n_words': 271}