file_configuration.py 文件源码

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

项目:punch 作者: lgiordani 项目源码 文件源码
def __init__(self, filepath, local_variables, global_variables=None):
        self.config = {}
        if global_variables:
            self.config.update(global_variables)

        new_local_variables = {}
        env = jinja2.Environment(undefined=jinja2.DebugUndefined)
        for key, value in local_variables.items():
            if six.PY2:
                value = value.decode('utf8')

            template = env.from_string(value)
            new_local_variables[key] = template.render(
                GLOBALS=global_variables)

        self.config.update(new_local_variables)
        self.path = filepath
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号