<commit_before># 
# Author    : <NAME>
# Project   : trackhub-creator
# Timestamp : 28-06-2017 11:03
# ---
# © 2017 <NAME> <<EMAIL>>
# All rights reserved.
# 

"""
This module implements some useful functions for the pipeline runner
"""

import os
import json
from exceptions import ToolBoxException


def read_json(json_file="json_file_not_specified.json"):
    """
    Reads a json file and it returns its object representation, no extra checks
    are performed on the file so, in case anything happens, the exception will
    reach the caller
    :param json_file: path to the file in json format to read
    :return: an object representation of the data in the json file
    """
    with open(json_file) as jf:
        return json.load(jf)


def check_create_folders(folders):
    """
    Check if folders exist, create them otherwise
    :param folders: list of folder paths to check
    :return: no return value
    """
    for folder in folders:
        if not os.path.isdir(folder):
            if os.path.exists(folder):
                raise ToolBoxException("'{}' is not a folder".format(folder))
            else:
                try:
                    os.mkdir(folder)
                except Exception as e:
                    raise ToolBoxException(str(e))


if __name__ == '__main__':
    print("ERROR: This script is part of a pipeline collection and it is not met to be run in stand alone mode")<commit_msg>typo fixed<commit_after># 
# Author    : <NAME>
# Project   : trackhub-creator
# Timestamp : 28-06-2017 11:03
# ---
# © 2017 <NAME> <<EMAIL>>
# All rights reserved.
# 

"""
This module implements some useful functions for the pipeline runner
"""

import os
import json
from exceptions import ToolBoxException


def read_json(json_file="json_file_not_specified.json"):
    """
    Reads a json file and it returns its object representation, no extra checks
    are performed on the file so, in case anything happens, the exception will
    reach the caller
    :param json_file: path to the file in json format to read
    :return: an object representation of the data in the json file
    """
    with open(json_file) as jf:
        return json.load(jf)


def check_create_folders(folders):
    """
    Check if folders exist, create them otherwise
    :param folders: list of folder paths to check
    :return: no return value
    """
    for folder in folders:
        if not os.path.isdir(folder):
            if os.path.exists(folder):
                raise ToolBoxException("'{}' is not a folder".format(folder))
            else:
                try:
                    os.mkdir(folder)
                except Exception as e:
                    raise ToolBoxException(str(e))


if __name__ == '__main__':
    print("ERROR: This script is part of a pipeline collection and it is not meant to be run in stand alone mode")
{'fraction_non_alphanumeric': 0.08336252189141856, 'fraction_numerical': 0.011208406304728547, 'mean_word_length': 2.596977329974811, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '590692', 'n_tokens_mistral': 829, 'n_tokens_neox': 776, 'n_words': 322}