data_Utils.py 文件源码

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

项目:warriorframework 作者: warriorframework 项目源码 文件源码
def get_filepath_from_system(datafile, system_name, *args):
    """ This function takes variable number of tag names as input and
    returns a list of absolute paths for all the tag values.
    In case of non-string tag values, it will simply return those
    non-string values.
    """

    abspath_lst = []
    credentials = get_credentials(datafile, system_name, args)
    start_directory = os.path.dirname(datafile)

    for tag in args:
        if isinstance(credentials[tag], str) or credentials[tag] is False:
            abspath = file_Utils.getAbsPath(credentials[tag], start_directory)
            if abspath:
                if os.path.isfile(abspath):
                    abspath_lst.append(abspath)
                else:
                    print_warning("File '{0}' provided for tag '{1}' does not "
                                  "exist".format(abspath, tag))
                    abspath_lst.append(None)
            else:
                abspath_lst.append(None)
        else:
            abspath_lst.append(credentials[tag])

    return abspath_lst
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号