<commit_before>import shutil
import json
import os

def main():
    shutil.copyfile('/generator/infrabox.json', '/infrabox/output/infrabox.json')
    shutil.copyfile('/generator/tests.json', '/infrabox/output/tests.json')

    deployments = None
    with open('/generator/deployments.json') as dep:
        deployments = json.load(dep)

    tag = os.environ.get('INFRABOX_GIT_TAG', None)
    if tag:
        for j in deployments['jobs']:
            for d in j.get('deployments', []):
                d['tag'] = tag

    with open('/infrabox/output/deployments.json', 'w') as out:
        print json.dumps(deployments, indent=4)
        json.dump(deployments, out)

if __name__ == "__main__":
    main()<commit_msg>also deploy images with 'latest' tag<commit_after>import shutil
import json
import os
import copy

def main():
    shutil.copyfile('/generator/infrabox.json', '/infrabox/output/infrabox.json')
    shutil.copyfile('/generator/tests.json', '/infrabox/output/tests.json')

    deployments = None
    with open('/generator/deployments.json') as dep:
        deployments = json.load(dep)

    tag = os.environ.get('INFRABOX_GIT_TAG', None)
    if tag:
        for j in deployments['jobs']:
            deps = j.get('deployments', [])

            if not deps:
                continue

            new_deps = []

            for d in deps:
                new_dep_tag = copy.deepcopy(d)
                new_dep_latest = copy.deepcopy(d)

                new_dep_tag['tag'] = tag
                new_dep_latest['tag'] = 'latest'

                new_deps.append(d)
                new_deps.append(new_dep_tag)
                new_deps.append(new_dep_latest)

            j['deployments'] = new_deps

    with open('/infrabox/output/deployments.json', 'w') as out:
        print json.dumps(deployments, indent=4)
        json.dump(deployments, out)

if __name__ == "__main__":
    main()
{'fraction_non_alphanumeric': 0.12981530343007916, 'fraction_numerical': 0.0010554089709762533, 'mean_word_length': 2.3617021276595747, 'pattern_counts': {'":': 2, '<': 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': '6415015', 'n_tokens_mistral': 646, 'n_tokens_neox': 613, 'n_words': 122}