__init__.py 文件源码

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

项目:threatdetectionservice 作者: flyballlabs 项目源码 文件源码
def _find_packages_iter(cls, where, exclude, include):
        """
        All the packages found in 'where' that pass the 'include' filter, but
        not the 'exclude' filter.
        """
        for root, dirs, files in os.walk(where, followlinks=True):
            # Copy dirs to iterate over it, then empty dirs.
            all_dirs = dirs[:]
            dirs[:] = []

            for dir in all_dirs:
                full_path = os.path.join(root, dir)
                rel_path = os.path.relpath(full_path, where)
                package = rel_path.replace(os.path.sep, '.')

                # Check if the directory is a package and passes the filters
                if ('.' not in dir
                        and include(package)
                        and not exclude(package)
                        and cls._looks_like_package(full_path)):
                    yield package
                    dirs.append(dir)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号