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

"""This is a **proof-of-concept** CLion project generator."""

import functools
import json
import subprocess

subprocess.check_call(['cook', '--results'])

with open('results.json') as file:
    content = json.load(file)

with open('CMakeLists.txt', 'w') as file:
    w = functools.partial(print, file=file)
    w('cmake_minimum_required(VERSION 2.8.8)')
    w()
    w('add_custom_target(COOK COMMAND cook '
      'WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})')
    w()

    outputs = {}
    for primary, result in content.items():
        for output in result['outputs']:
            outputs[output] = primary

    for primary, result in content.items():
        if result.get('type') == 'cpp.object':
            cpp = [file for file in result['inputs'] if file.endswith('.cpp')]<commit_msg>Add automatic regeneration for CLion<commit_after>#!/usr/bin/env python3

"""This is a **proof-of-concept** CLion project generator."""

import functools
import json
import subprocess
import sys

subprocess.check_call(['cook', '--results'])

with open('results.json') as file:
    content = json.load(file)

with open('CMakeLists.txt', 'w') as file:
    w = functools.partial(print, file=file)
    w('cmake_minimum_required(VERSION 2.8.8)')
    w()
    w('add_custom_target(COOK COMMAND ' + sys.executable + ' clion.py COMMAND cook '
      'WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})')
    w()

    outputs = {}
    for primary, result in content.items():
        for output in result['outputs']:
            outputs[output] = primary

    for primary, result in content.items():
        if result.get('type') == 'cpp.object':
            cpp = [file for file in result['inputs'] if file.endswith('.cpp')]
{'fraction_non_alphanumeric': 0.14793577981651376, 'fraction_numerical': 0.0045871559633027525, 'mean_word_length': 3.5207253886010363, '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': '6679342', 'n_tokens_mistral': 570, 'n_tokens_neox': 542, 'n_words': 144}