reports.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:netbox 作者: digitalocean 项目源码 文件源码
def get_reports():
    """
    Compile a list of all reports available across all modules in the reports path. Returns a list of tuples:

    [
        (module_name, (report, report, report, ...)),
        (module_name, (report, report, report, ...)),
        ...
    ]
    """
    module_list = []

    # Iterate through all modules within the reports path. These are the user-created files in which reports are
    # defined.
    for importer, module_name, is_pkg in pkgutil.walk_packages([settings.REPORTS_ROOT]):
        module = importlib.import_module('reports.{}'.format(module_name))
        report_list = [cls() for _, cls in inspect.getmembers(module, is_report)]
        module_list.append((module_name, report_list))

    return module_list
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号