<commit_before># This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import argparse
import os
import relengapi.app

from relengapi.lib import subcommands
from relengapi.lib.logging import setupConsoleLogging


def main(args=None):
    parser = argparse.ArgumentParser(
        description="Releng API Command Line Tool")
    parser.add_argument("--quiet", '-q', action='store_true',
                        help="Silence all logging below WARNING level")
    subparsers = parser.add_subparsers(help='sub-command help')

    # each of the Subcommand subclasses was loaded when the blueprints were
    # imported in relengapi.app
    cmds = [cls() for cls in subcommands.Subcommand.__subclasses__()]
    for cmd in cmds:
        subparser = cmd.make_parser(subparsers)
        subparser.set_defaults(_subcommand=cmd)

    args = parser.parse_args(args)

    if args._subcommand and args._subcommand.want_logging:
        setupConsoleLogging(args.quiet)

    # make the RELENGAPI_SETTINGS env var an absolute path; without this, Flask
    # uses the application's root_dir, which isn't especially helpful in a
    # development context.
    var_name = 'RELENGAPI_SETTINGS'
    if var_name in os.environ:
        os.environ[var_name] = os.path.abspath(os.environ[var_name])<commit_msg>Add an option to disable all logging<commit_after># This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import argparse
import logging
import os
import relengapi.app

from relengapi.lib import subcommands
from relengapi.lib.logging import setupConsoleLogging


def main(args=None):
    parser = argparse.ArgumentParser(
        description="Releng API Command Line Tool")
    parser.add_argument("--quiet", '-q', action='store_true',
                        help="Silence all logging below WARNING level")
    parser.add_argument("--disable-logging", '-Q', action='store_true',
                        help="Silence all logging")
    subparsers = parser.add_subparsers(help='sub-command help')

    # each of the Subcommand subclasses was loaded when the blueprints were
    # imported in relengapi.app
    cmds = [cls() for cls in subcommands.Subcommand.__subclasses__()]
    for cmd in cmds:
        subparser = cmd.make_parser(subparsers)
        subparser.set_defaults(_subcommand=cmd)

    args = parser.parse_args(args)

    if args._subcommand and args._subcommand.want_logging and not args.disable_logging:
        setupConsoleLogging(args.quiet)
    else:
        # blueprints.slaveloan.bugzilla complains about not having a handler
        logging.getLogger().addHandler(logging.NullHandler())

    # make the RELENGAPI_SETTINGS env var an absolute path; without this, Flask
    # uses the application's root_dir, which isn't especially helpful in a
    # development context.
    var_name = 'RELENGAPI_SETTINGS'
    if var_name in os.environ:
        os.environ[var_name] = os.path.abspath(os.environ[var_name])
{'fraction_non_alphanumeric': 0.0851063829787234, 'fraction_numerical': 0.0025031289111389237, 'mean_word_length': 3.4713286713286715, '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': '7272701', 'n_tokens_mistral': 947, 'n_tokens_neox': 925, 'n_words': 295}