timeline_handler.py 文件源码

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

项目:chainerboard 作者: koreyou 项目源码 文件源码
def _find_get_patten_match_single(dic, match_func):
    """
    Find a matching key from dict. This function returns value when the
    found match is the only match in the dict.

    Args:
        dic (dict): Mapping from a key (str) to corresponding metric (numeric)
            from one output of LogReporter.
        match_func (func): A function that takes a variable (str) as input and
            returns a bool if it is a valid match.

    Returns:
        str or None

    """
    # match_func(str) -> bool
    found_key = None
    for k in six.iterkeys(dic):
        if match_func(k):
            if found_key is None:
                found_key = k
            else:
                # The second match is found
                return None
    return found_key
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号