Run all the checks in a check_module
509033
def _check_loop(self, obj, check_mod_str):
        ''''''
        check_module = self._check_modules[check_mod_str]
        checks = self._config['checks'][check_mod_str]
        result = True
        summary = OrderedDict()
        for check in checks:
            ok = self._do_check(obj, check_module, check)
            summary[ok.title] = ok.status
            result &= ok.status

        return result, summary
931795
def find_all_checks(self, **kwargs):
        
        checks = self._check_manager.find_all_checks(**kwargs)
        for check in checks:
            check.set_entity(self)
        return checks
1293487
def runAllInDir(dir_path, exclude=[], add_args=(), ignoreErrors=True):
    
    print('testing all modules of %s' % dir_path)

    if type(add_args) in (tuple, list):
        sys.argv.extend(add_args)
    else:
        sys.argv.append(add_args)
    t = 0
    failed = []
    for _, modname, ispkg in pkgutil.walk_packages(
            [dir_path],
            #onerror=lambda x: None
    ):
        if not ispkg and modname != thismodname and modname not in exclude:  # don't test this module
            print('... %s' % modname)
            t0 = time()
            try:
                runpy.run_module(
                    modname,
                    init_globals=None,
                    run_name='__main__',
                    alter_sys=False)
            except Exception as err:
                if ignoreErrors:
                    print("FAILED: %s" % err)
                else:
                    raise err
                failed.append((modname, err))
            dt = time() - t0
            t += dt
            print('execution time=%s' % dt)
    print('----------------')
    print('time needed=%s' % t)
    if failed:
        print('=======================')
        print('failed for %s modules' % len(failed))
        print('-----------------------')
        for mod, err in failed:
            print(mod, err)
925426
def __run_post_all(self):
        """"""

        # if the list of delta dirs is [delta1, delta2] the post scripts of delta1 are
        # executed before the post scripts of delta2

        for d in self.dirs:
            post_all_py_path = os.path.join(d, 'post-all.py')
            if os.path.isfile(post_all_py_path):
                print('     Applying post-all.py...', end=' ')
                self.__run_py_file(post_all_py_path, 'post-all')
                print('OK')

            post_all_sql_path = os.path.join(d, 'post-all.sql')
            if os.path.isfile(post_all_sql_path):
                print('     Applying post-all.sql...', end=' ')
                self.__run_sql_file(post_all_sql_path)
                print('OK')
1319743
def run(self, ds, skip_checks, *checker_names):
        

        ret_val = {}
        checkers = self._get_valid_checkers(ds, checker_names)

        if skip_checks is not None:
            skip_check_dict = CheckSuite._process_skip_checks(skip_checks)
        else:
            skip_check_dict = defaultdict(lambda: None)

        if len(checkers) == 0:
            print("No valid checkers found for tests '{}'".format(",".join(checker_names)))

        for checker_name, checker_class in checkers:

            checker = checker_class() # instantiate a Checker object
            checker.setup(ds)         # setup method to prep

            checks = self._get_checks(checker, skip_check_dict)
            vals = []
            errs = {}   # check method name -> (exc, traceback)

            for c, max_level in checks:
                try:
                    vals.extend(self._run_check(c, ds, max_level))
                except Exception as e:
                    errs[c.__func__.__name__] = (e, sys.exc_info()[2])

            # score the results we got back
            groups = self.scores(vals)

            ret_val[checker_name] = groups, errs

        return ret_val
1322939
def db_check(name,
             table=None,
             **connection_args):
    '''
    
    '''
    ret = []
    if table is None:
        # we need to check all tables
        tables = db_tables(name, **connection_args)
        for table in tables:
            log.info('Checking table \'%s\' in db \'%s\'..', name, table)
            ret.append(__check_table(name, table, **connection_args))
    else:
        log.info('Checking table \'%s\' in db \'%s\'..', name, table)
        ret = __check_table(name, table, **connection_args)
    return ret
1193533
def compile(checks):
    """"""

    out = ["import check50"]

    for name, check in checks.items():
        out.append(_compile_check(name, check))

    return "\n\n".join(out)
490996
public function run($checks)
    {
        if (is_array($checks) && count($checks) > 0) {
            foreach ($checks as $check_type => $check_info) {
                switch ($check_type) {
                    case 'auth':
                        $check_result = (new Auth())->run($this->dic['session_id']);
                        break;

                    case 'role':
                        $check_result = (new Role())->run($check_info, $this->dic['user']['roles']);
                        break;

                    default:
                        $classname = 'Lemurro\\Api\\App\\Checker\\' . $check_info['class'];
                        $class = new $classname($this->dic);
                        $check_result = call_user_func([$class, 'run'], $check_info);
                        break;
                }

                if (isset($check_result['errors'])) {
                    return $check_result;
                }
            }
        }

        return [];
    }
20686
def run_all_evals(models, treebanks, out_file, check_parse, print_freq_tasks):
    "
    print_header = True

    for tb_lang, treebank_list in treebanks.items():
        print()
        print("Language", tb_lang)
        for text_path in treebank_list:
            print(" Evaluating on", text_path)

            gold_path = text_path.parent / (text_path.stem + '.conllu')
            print("  Gold data from ", gold_path)

            # nested try blocks to ensure the code can continue with the next iteration after a failure
            try:
                with gold_path.open(mode='r', encoding='utf-8') as gold_file:
                    gold_ud = conll17_ud_eval.load_conllu(gold_file)

                for nlp, nlp_loading_time, nlp_name in models[tb_lang]:
                    try:
                        print("   Benchmarking", nlp_name)
                        tmp_output_path = text_path.parent / str('tmp_' + nlp_name + '.conllu')
                        run_single_eval(nlp, nlp_loading_time, nlp_name, text_path, gold_ud, tmp_output_path, out_file,
                                        print_header, check_parse, print_freq_tasks)
                        print_header = False
                    except Exception as e:
                        print("    Ran into trouble: ", str(e))
            except Exception as e:
                print("   Ran into trouble: ", str(e))
843129
def _do_check(self, obj, check_module, check_str):
        ''''''
        opts = self._config['options']
        if check_str in opts:
            fargs = opts[check_str]
            if isinstance(fargs, list):
                out = check_wrapper(getattr(check_module, check_str))(obj, *fargs)
            else:
                out = check_wrapper(getattr(check_module, check_str))(obj, fargs)
        else:
            out = check_wrapper(getattr(check_module, check_str))(obj)

        try:
            if out.info:
                L.debug('%s: %d failing ids detected: %s',
                        out.title, len(out.info), out.info)
        except TypeError:  # pragma: no cover
            pass

        return out
1094843
def run_check(self, template_name=None, service_dir=None):
        "  "

        print_header('Check requirements', sep='-')
        map(lambda cmd: call("bash %s" % cmd), self._gen_scripts(
            'check', template_name=template_name, service_dir=service_dir))
        return True
676257
def check(
    state,
    unused=False,
    style=False,
    ignore=None,
    args=None,
    **kwargs
):
    """"""
    from ..core import do_check

    do_check(
        three=state.three,
        python=state.python,
        system=state.system,
        unused=unused,
        ignore=ignore,
        args=args,
        pypi_mirror=state.pypi_mirror,
    )
806622
def run(
    categories, param_file, project_dir, plugin, target,
    status_update_interval
):
    
    return _run(
        categories, param_file, project_dir, plugin, target,
        status_update_interval
    )
966022
def start_executing_host_checks(self):
        
        # todo: #783 create a dedicated brok for global parameters
        if not self.my_conf.execute_host_checks:
            self.my_conf.modified_attributes |= DICT_MODATTR["MODATTR_ACTIVE_CHECKS_ENABLED"].value
            self.my_conf.execute_host_checks = True
            self.my_conf.explode_global_conf()
            self.daemon.update_program_status()
1365924
def checks(self):
        ''''''
        condition = lambda a: a.startswith('check_')
        return (getattr(self, a) for a in dir(self) if condition(a))
708552
def load_checkers():
    """"""
    for loader, name, _ in pkgutil.iter_modules([os.path.join(__path__[0], 'checkers')]):
        loader.find_module(name).load_module(name)
760814
def _add_check(self, node, run, language, is_code_node):
        """"""
        def run_check():
            """Yield errors."""
            all_results = run()
            if all_results is not None:
                if all_results:
                    for result in all_results:
                        error_offset = result[0] - 1

                        line_number = getattr(node, 'line', None)
                        if line_number is not None:
                            yield (
                                beginning_of_code_block(
                                    node=node,
                                    line_number=line_number,
                                    full_contents=self.contents,
                                    is_code_node=is_code_node) +
                                error_offset,
                                '({}) {}'.format(language, result[1]))
                else:
                    yield (self.filename, 0, 'unknown error')
        self.checkers.append(run_check)