pydotenv.py 文件源码

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

项目:libbuild 作者: appscode 项目源码 文件源码
def resolve_nested_variables(values):
    def _replacement(name):
        """
        get appropiate value for a variable name.
        first search in environ, if not found,
        then look into the dotenv variables
        """
        ret = os.getenv(name, values.get(name, ""))
        return ret

    def _re_sub_callback(match_object):
        """
        From a match object gets the variable name and returns
        the correct replacement
        """
        return _replacement(match_object.group()[2:-1])

    for k, v in values.items():
        values[k] = __posix_variable.sub(_re_sub_callback, v)

    return values
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号