providers.py 文件源码

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

项目:hypr2 作者: project-hypr 项目源码 文件源码
def _call_meth(self, match_info, name):
        # call meth with variable segments of the request as arguments.
        meth = getattr(self, name)
        if (not asyncio.iscoroutinefunction(meth) and
                not inspect.isgeneratorfunction(meth)):
            meth = asyncio.coroutine(meth)

        # get variable segments for the current provider.
        var = {k: v for k, v in match_info.items() if not k.startswith('_')}

        # get method signature and apply variable segments
        req, _, kw, _ = inspect.getargspec(getattr(meth, '__wrapped__', meth))
        if kw is None:
            rv = yield from meth(**{k: v for k, v in var.items() if k in req})
        else:
            rv = yield from meth(**var)  # any kerword arguments is accepted
        return rv
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号