sanity.py 文件源码

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

项目:reframe 作者: eth-cscs 项目源码 文件源码
def extractall(patt, filename, tag=0, conv=None, encoding='utf-8'):
    """Extract all values from the capturing group ``tag`` of a matching regex
    ``patt`` in the file ``filename``.

    :arg patt: The regex pattern to search.
        Any standard Python `regular expression
        <https://docs.python.org/3.6/library/re.html#regular-expression-syntax>`_
        is accepted.
    :arg filename: The name of the file to examine.
    :arg encoding: The name of the encoding used to decode the file.
    :arg tag: The regex capturing group to be extracted.
        Group ``0`` refers always to the whole match.
        Since the file is processed line by line, this means that group ``0``
        returns the whole line that was matched.
    :arg conv: A callable that takes a single argument and returns a new value.
        If provided, it will be used to convert the extracted values before
        returning them.
    :returns: A list of the extracted values from the matched regex.
    :raises reframe.core.exceptions.SanityError: In case of errors.
    """
    return list(evaluate(x)
                for x in extractiter(patt, filename, tag, conv, encoding))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号