<commit_before>#!/usr/bin/env python

import os
import sys
try:
    import pyhande
except ImportError:
    # Try to find pyhande in the hande directory tree.
    scriptdir = os.path.dirname(sys.argv[0])
    sys.path.append(os.path.join(scriptdir, '..'))
    import pyhande
import pyhande.testcode


def main(filename):

    data = pyhande.testcode.extract_test_data(filename)
    output = []
    for (key, val) in data.items():
        output.append((key, val.to_string(index=False, index_names=False)))

    return '\n\n'.join('\n'.join(calc_out) for calc_out in output)

if __name__ == '__main__':

    if len(sys.argv) == 1:
        print('usage: extract_test_data.py file')
        sys.exit(1)
    print(main(sys.argv[1]))
<commit_msg>Ensure the same precision is used in extract_test_data.<commit_after>#!/usr/bin/env python

import os
import sys
try:
    import pyhande
except ImportError:
    # Try to find pyhande in the hande directory tree.
    scriptdir = os.path.dirname(sys.argv[0])
    sys.path.append(os.path.join(scriptdir, '..'))
    import pyhande
import pyhande.testcode


def main(filename):

    data = pyhande.testcode.extract_test_data(filename)
    output = []
    for (key, val) in data.items():
        output.append((key, val.to_string(index=False, index_names=False, float_format='{:.10f}'.format)))

    return '\n\n'.join('\n'.join(calc_out) for calc_out in output)

if __name__ == '__main__':

    if len(sys.argv) == 1:
        print('usage: extract_test_data.py file')
        sys.exit(1)
    print(main(sys.argv[1]))

{'fraction_non_alphanumeric': 0.14055448098001289, 'fraction_numerical': 0.006447453255963894, 'mean_word_length': 3.4597701149425286, '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': '4368782', 'n_tokens_mistral': 553, 'n_tokens_neox': 541, 'n_words': 122}