<commit_before>#!/usr/bin/python3

__version__ = "0.0.1"

import logging
import idifference
import os

def make_status_dict(results_dirname, expected_result_names):
    """
    Returns a dictionary.
    Key: DFXML file basename
    Value: Pair, (return code, path to xmllint's stderr file)
    """
    retval = dict()
    if not os.path.exists(results_dirname):
        return retval
    for (dirpath, dirnames, filenames) in os.walk(results_dirname):
        for filename in filenames:
            if not filename.endswith(".status.log"):
                continue
            bn = filename.replace(".status.log","")
            if bn not in expected_result_names:
                continue
            slog_fn = filename
            elog_fn = filename.replace(".status.log", ".err.log")
            rc = None
            with open(os.path.join(dirpath, slog_fn), "r") as slog_fh:
                rc_txt = slog_fh.read(10).strip()
                if rc_txt != "":<commit_msg>Investigate pathing issues<commit_after>#!/usr/bin/python3

__version__ = "0.0.1"

import logging
import idifference
import os

def make_status_dict(results_dirname, expected_result_names):
    """
    Returns a dictionary.
    Key: DFXML file basename
    Value: Pair, (return code, path to xmllint's stderr file)
    """
    retval = dict()
    if not os.path.exists(results_dirname):
        logging.debug("Could not find results subdirectory %r; returning empty status dictionary." % results_dirname)
        return retval
    for (dirpath, dirnames, filenames) in os.walk(results_dirname):
        for filename in filenames:
            if not filename.endswith(".status.log"):
                continue
            bn = filename.replace(".status.log","")
            if bn not in expected_result_names:
                continue
            slog_fn = filename
            elog_fn = filename.replace(".status.log", ".err.log")
            rc = None
            with open(os.path.join(dirpath, slog_fn), "r") as slog_fh:
                rc_txt = slog_fh.read(10).strip()
                if rc_txt != "":
{'fraction_non_alphanumeric': 0.1063011063011063, 'fraction_numerical': 0.005772005772005772, 'mean_word_length': 2.2550860719874803, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '5165282', 'n_tokens_mistral': 635, 'n_tokens_neox': 605, 'n_words': 161}