messages.py 文件源码

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

项目:gax-python 作者: googleapis 项目源码 文件源码
def get_messages(module):
    """Return a dictionary of message names and objects.

    Args:
        module (module): A Python module; dir() will be run against this
            module to find Message subclasses.

    Returns:
        dict[str, Message]: A dictionary with the Message class names as
            keys, and the Message subclasses themselves as values.
    """
    answer = collections.OrderedDict()
    for name in dir(module):
        candidate = getattr(module, name)
        if inspect.isclass(candidate) and issubclass(candidate, Message):
            answer[name] = candidate
    return answer
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号