loaders.py 文件源码

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

项目:tellmeabout.coffee 作者: billyfung 项目源码 文件源码
def __init__(self, path):
        package_name = '_jinja2_module_templates_%x' % id(self)

        # create a fake module that looks for the templates in the
        # path given.
        mod = _TemplateModule(package_name)
        if isinstance(path, string_types):
            path = [path]
        else:
            path = list(path)
        mod.__path__ = path

        sys.modules[package_name] = weakref.proxy(mod,
            lambda x: sys.modules.pop(package_name, None))

        # the only strong reference, the sys.modules entry is weak
        # so that the garbage collector can remove it once the
        # loader that created it goes out of business.
        self.module = mod
        self.package_name = package_name
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号