<commit_before>

import yaml
import sys
BASE_NAME = "iroha-mizuki-cli"

def load():
    import yaml
    import os
    try:
        data = yaml.load(open("config.yml", "r"), yaml.SafeLoader)
        if not "account" in data:
            print("[{}] Require account dict".format(BASE_NAME))
            sys.exit(1)

        if not "peer" in data:
            print("[{}] Require peer dict".format(BASE_NAME))
            sys.exit(1)

        name = data["account"].get("name")
        publicKey = data["account"].get("publicKey")
        privateKey = data["account"].get("privateKey")
        if not name:
            print("[{}]  Require name in account".format(BASE_NAME))
            raise
        if not publicKey:
            print("[{}]  Require publicKey in account".format(BASE_NAME))
            raise
        if not privateKey:
            print("[{}]  Require publicKey in account".format(BASE_NAME))
            raise

        address = data["peer"].get("address")
        port = data["peer"].get("port")
        if not address:
            print("[{}]  Require address in peer".format(BASE_NAME))
            raise
        if not port:
            print("[{}]  Require port in peer".format(BASE_NAME))
            raise

        print("[{}] use config.yml data".format(BASE_NAME))
    except yaml.YAMLError as exc:
        print("[{}] Error while parsing YAML file:".format(BASE_NAME))
        if hasattr(exc, 'problem_mark'):
            if exc.context is not None:
                print("""
                [{}] 
                  parser says
                  -----------
                  {}
                  {} {}
                  Could you correct it?
                """.format(
                    BASE_NAME,
                    exc.problem_mark,
                    exc.problem,
                    exc.context
                ))
            else:
                print("""
                [{}] 
                  parser says
                  -----------
                  {}<commit_msg>Add printInfo option to loader<commit_after>

import yaml
import sys
BASE_NAME = "iroha-mizuki-cli"

def load(printInfo = False):
    import yaml
    import os
    try:
        data = yaml.load(open("config.yml", "r"), yaml.SafeLoader)
        if not "account" in data:
            print("[{}] Require account dict".format(BASE_NAME))
            sys.exit(1)

        if not "peer" in data:
            print("[{}] Require peer dict".format(BASE_NAME))
            sys.exit(1)

        name = data["account"].get("name")
        publicKey = data["account"].get("publicKey")
        privateKey = data["account"].get("privateKey")
        if not name:
            print("[{}]  Require name in account".format(BASE_NAME))
            raise
        if not publicKey:
            print("[{}]  Require publicKey in account".format(BASE_NAME))
            raise
        if not privateKey:
            print("[{}]  Require publicKey in account".format(BASE_NAME))
            raise

        address = data["peer"].get("address")
        port = data["peer"].get("port")
        if not address:
            print("[{}]  Require address in peer".format(BASE_NAME))
            raise
        if not port:
            print("[{}]  Require port in peer".format(BASE_NAME))
            raise

        if printInfo:
            print("[{}] use config.yml data".format(BASE_NAME))
    except yaml.YAMLError as exc:
        print("[{}] Error while parsing YAML file:".format(BASE_NAME))
        if hasattr(exc, 'problem_mark'):
            if exc.context is not None:
                print("""
                [{}] 
                  parser says
                  -----------
                  {}
                  {} {}
                  Could you correct it?
                """.format(
                    BASE_NAME,
                    exc.problem_mark,
                    exc.problem,
                    exc.context
                ))
            else:
                print("""
                [{}] 
                  parser says
                  -----------
                  {}
{'fraction_non_alphanumeric': 0.1303921568627451, 'fraction_numerical': 0.000980392156862745, 'mean_word_length': 1.3306681896059394, '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': '7434431', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1016, 'n_words': 269}