<commit_before>#! /usr/bin/env python
# flake8: NOQA

import sys
import os
import json
import tempfile

all_suites_json_path = 'suites.json'
tests_suites = os.environ['SYSTEM_TESTS_SUITES'].split(',')
custom_suite = os.environ['SYSTEM_TESTS_CUSTOM_SUITE']
custom_suite_name = os.environ['SYSTEM_TESTS_CUSTOM_SUITE_NAME']
custom_tests_to_run = os.environ['SYSTEM_TESTS_CUSTOM_TESTS_TO_RUN']
custom_cloudify_config = os.environ['SYSTEM_TESTS_CUSTOM_CLOUDIFY_CONFIG']
custom_handler_module = os.environ['SYSTEM_TESTS_CUSTOM_HANDLER_MODULE']

suites_json_path = tempfile.mktemp(prefix='suites-', suffix='.json')

if custom_suite:
    suites = [{
        'suite_name': custom_suite_name,
        'tests_to_run': custom_tests_to_run,
        'cloudify_test_config': custom_cloudify_config,
        'cloudify_test_handler_module': custom_handler_module
    }]
else:
    with open(all_suites_json_path) as f:
        all_suites = json.loads(f.read())
    suites = []
    for suite in all_suites:
        if suite['suite_name'] in tests_suites:
            suites.append(suite)

with open(suites_json_path, 'w') as f:
    f.write(json.dumps(suites))

sys.stdout.write(suites_json_path)<commit_msg>CFY-959 for testing<commit_after>#! /usr/bin/env python
# flake8: NOQA

import sys
import os
import json
import tempfile

all_suites_json_path = 'suites.json'
tests_suites = os.environ['SYSTEM_TESTS_SUITES'].split(',')
custom_suite = os.environ['SYSTEM_TESTS_CUSTOM_SUITE']
custom_suite_name = os.environ['SYSTEM_TESTS_CUSTOM_SUITE_NAME']
custom_tests_to_run = os.environ['SYSTEM_TESTS_CUSTOM_TESTS_TO_RUN']
custom_cloudify_config = os.environ['SYSTEM_TESTS_CUSTOM_CLOUDIFY_CONFIG']
custom_handler_module = os.environ['SYSTEM_TESTS_CUSTOM_HANDLER_MODULE']

suites_json_path = tempfile.mktemp(prefix='suites-', suffix='.json')

if custom_suite:
    suites = [{
        'suite_name': custom_suite_name,
        'tests_to_run': custom_tests_to_run,
        'cloudify_test_config': custom_cloudify_config,
        'cloudify_test_handler_module': custom_handler_module,
        'custom_suite': custom_suite
    }]
else:
    with open(all_suites_json_path) as f:
        all_suites = json.loads(f.read())
    suites = []
    for suite in all_suites:
        if suite['suite_name'] in tests_suites:
            suites.append(suite)

with open(suites_json_path, 'w') as f:
    f.write(json.dumps(suites))

sys.stdout.write(suites_json_path)
{'fraction_non_alphanumeric': 0.10867768595041322, 'fraction_numerical': 0.002066115702479339, 'mean_word_length': 5.144670050761421, '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': '5800064', 'n_tokens_mistral': 899, 'n_tokens_neox': 903, 'n_words': 133}