Exemplo n.º 1
0
def get_mod_stats():
    # TODO: docstring percentage.
    import pkgutil
    from boltons.funcutils import get_module_callables

    mod_count = 0
    tot_type_count = 0
    tot_func_count = 0
    ignore = lambda attr_name: attr_name.startswith('_')
    for _, mod_name, _ in pkgutil.iter_modules([PACKAGE_PATH]):
        if not mod_name.endswith('utils'):
            continue
        mod = __import__(mod_name)
        types, funcs = get_module_callables(mod, ignore=ignore)
        if not len(types) and not len(funcs):
            continue
        mod_count += 1
        tot_type_count += len(types)
        tot_func_count += len(funcs)

    ret = (mod_count, tot_type_count, tot_func_count)
    print('==== %s modules ==== %s types ==== %s funcs ====' % ret)
    return ret
Exemplo n.º 2
0
def get_mod_stats():
    # TODO: docstring percentage.
    import pkgutil
    from boltons.funcutils import get_module_callables

    mod_count = 0
    tot_type_count = 0
    tot_func_count = 0
    ignore = lambda attr_name: attr_name.startswith('_')
    for _, mod_name, _ in pkgutil.iter_modules([PACKAGE_PATH]):
        if not mod_name.endswith('utils'):
            continue
        mod = __import__(mod_name)
        types, funcs = get_module_callables(mod, ignore=ignore)
        if not len(types) and not len(funcs):
            continue
        mod_count += 1
        tot_type_count += len(types)
        tot_func_count += len(funcs)

    ret = (mod_count, tot_type_count, tot_func_count)
    print ('==== %s modules ==== %s types ==== %s funcs ====' % ret)
    return ret