run.py 文件源码

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

项目:metricsandstuff 作者: bucknerns 项目源码 文件源码
def get_routes(package):
    routes = []
    for _, modname, ispkg in pkgutil.walk_packages(
        path=package.__path__,
        prefix=package.__name__ + '.',
            onerror=lambda x: None):
        if not ispkg:
            module = import_module(modname)
            for k, cls in vars(module).items():
                if k.startswith("_") or not isinstance(cls, six.class_types):
                    continue
                if issubclass(cls, BaseAPI):
                    if getattr(cls, "route", False):
                        routes.append(cls)
    return routes

# monkeypatch to force application json on raised exceptions
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号