<commit_before>import json
import time
import datetime
import subprocess

def getData(printer):
    """Return the data from calling lpq with the specified printer."""
    cmd = 'lpq -P' + printer
    data = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read()
    return(data.decode('utf-8'))

def parseData(list):
    """Returns the list without the header lines."""
    return list[0:]

if __name__ == '__main__':
    # Gets all the data
    p2210a = getData('p2210a').split('\n')
    p2210b = getData('p2210b').split('\n')
    p3185a = getData('p3185a').split('\n')

    data = {}

    ts = time.time()
    st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')

    data['timestamp'] = st
    
    data['2210a'] = parseData(p2210a)
    data['2210b'] = parseData(p2210b)
    data['3185a'] = parseData(p3185a)

    json_data = json.dumps(data)

    print(json_data)
<commit_msg>Remove some redundancy<commit_after>import json
import time
import datetime
import subprocess

def getData(printer):
    """Return the data from calling lpq with the specified printer as a list."""
    cmd = 'lpq -P' + printer
    data = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read()
    return(data.decode('utf-8').split('\n')

def parseData(list):
    """Returns the list without the header lines."""
    return list[0:]

if __name__ == '__main__':
    # Gets all the data
    p2210a = getData('p2210a')
    p2210b = getData('p2210b')
    p3185a = getData('p3185a')

    data = {}

    ts = time.time()
    st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')

    data['timestamp'] = st
    
    data['2210a'] = parseData(p2210a)
    data['2210b'] = parseData(p2210b)
    data['3185a'] = parseData(p3185a)

    print(json.dumps(data))
{'fraction_non_alphanumeric': 0.15924276169265034, 'fraction_numerical': 0.0556792873051225, 'mean_word_length': 3.619537275064267, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1898064', 'n_tokens_mistral': 698, 'n_tokens_neox': 638, 'n_words': 143}