<commit_before>""" Runs Airtime liquidsoap
"""
import argparse
import os
from . import generate_liquidsoap_cfg
import logging
import subprocess
from pypo import pure

PYPO_HOME = '/var/tmp/airtime/pypo/'

def run():
    '''Entry-point for this application'''
    print("Airtime Liquidsoap")
    parser = argparse.ArgumentParser()
    parser.add_argument("-d", "--debug", help="run in debug mode", action="store_true")
    args = parser.parse_args()

    os.environ["HOME"] = PYPO_HOME

    if args.debug:
        logging.basicConfig(level=getattr(logging, 'DEBUG', None))

    generate_liquidsoap_cfg.run()
    ''' check liquidsoap version if less than 1.3 use legacy liquidsoap script '''
    liquidsoap_version = subprocess.check_output("liquidsoap --version", shell=True, text=True)
    if pure.version_cmp(liquidsoap_version, "1.3") < 0:
        script_path = os.path.join(os.path.dirname(__file__), 'ls_script.liq')
    else:
        script_path = os.path.join(os.path.dirname(__file__), 'ls_script_legacy.liq')
    if args.debug:
        os.execl('/usr/bin/liquidsoap', 'airtime-liquidsoap', script_path, '--verbose', '-f', '--debug')
    else:
        os.execl('/usr/bin/liquidsoap', 'airtime-liquidsoap', script_path, '--verbose', '-f')

run()<commit_msg>Suggest using `universal_newlines` as the alias `text` only works for python 3.7 and above. Default python3 for example is 3.6 in Ubuntu Bionic and therefore liquidsoap fails with parameter `text`.<commit_after>""" Runs Airtime liquidsoap
"""
import argparse
import os
from . import generate_liquidsoap_cfg
import logging
import subprocess
from pypo import pure

PYPO_HOME = '/var/tmp/airtime/pypo/'

def run():
    '''Entry-point for this application'''
    print("Airtime Liquidsoap")
    parser = argparse.ArgumentParser()
    parser.add_argument("-d", "--debug", help="run in debug mode", action="store_true")
    args = parser.parse_args()

    os.environ["HOME"] = PYPO_HOME

    if args.debug:
        logging.basicConfig(level=getattr(logging, 'DEBUG', None))

    generate_liquidsoap_cfg.run()
    ''' check liquidsoap version if less than 1.3 use legacy liquidsoap script '''
    liquidsoap_version = subprocess.check_output("liquidsoap --version", shell=True, universal_newlines=True)
    if pure.version_cmp(liquidsoap_version, "1.3") < 0:
        script_path = os.path.join(os.path.dirname(__file__), 'ls_script.liq')
    else:
        script_path = os.path.join(os.path.dirname(__file__), 'ls_script_legacy.liq')
    if args.debug:
        os.execl('/usr/bin/liquidsoap', 'airtime-liquidsoap', script_path, '--verbose', '-f', '--debug')
    else:
        os.execl('/usr/bin/liquidsoap', 'airtime-liquidsoap', script_path, '--verbose', '-f')

run()
{'fraction_non_alphanumeric': 0.14243759177679882, 'fraction_numerical': 0.005506607929515419, 'mean_word_length': 4.009191176470588, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '6526496', 'n_tokens_mistral': 916, 'n_tokens_neox': 861, 'n_words': 208}