env.py 文件源码

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

项目:WhatTheHack 作者: Sylphias 项目源码 文件源码
def search_load_path(self, ctx, item):
        """This is called by :meth:`search_for_source` when a
        :attr:`Environment.load_path` is set.

        If you want to change how the load path is processed,
        overwrite this method.
        """
        if has_magic(item):
            # We glob all paths.
            result = []
            for path in ctx.load_path:
                result.extend(self.glob(path, item))
            return result
        else:
            # Single file, stop when we find the first match, or error
            # out otherwise. We still use glob() because then the load_path
            # itself can contain globs. Neat!
            for path in ctx.load_path:
                result = self.glob(path, item)
                if result:
                    return result
            raise IOError("'%s' not found in load path: %s" % (
                item, ctx.load_path))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号