• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python api.iterSourceCode函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyflakes.api.iterSourceCode函数的典型用法代码示例。如果您正苦于以下问题:Python iterSourceCode函数的具体用法?Python iterSourceCode怎么用?Python iterSourceCode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了iterSourceCode函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_singleFile

 def test_singleFile(self):
     """
     If the directory contains one Python file, C{iterSourceCode} will find
     it.
     """
     childpath = self.makeEmptyFile('foo.py')
     self.assertEqual(list(iterSourceCode([self.tempdir])), [childpath])
开发者ID:liangsuilong,项目名称:pyflakes,代码行数:7,代码来源:test_api.py


示例2: test_explicitFiles

 def test_explicitFiles(self):
     """
     If one of the paths given to L{iterSourceCode} is not a directory but
     a file, it will include that in its output.
     """
     epath = self.makeEmptyFile("e.py")
     self.assertEqual(list(iterSourceCode([epath])), [epath])
开发者ID:yamatogun,项目名称:pyflakes,代码行数:7,代码来源:test_api.py


示例3: test_shebang

    def test_shebang(self):
        """
        Find Python files that don't end with `.py`, but contain a Python
        shebang.
        """
        python = os.path.join(self.tempdir, 'a')
        with open(python, 'w') as fd:
            fd.write('#!/usr/bin/env python\n')

        self.makeEmptyFile('b')

        with open(os.path.join(self.tempdir, 'c'), 'w') as fd:
            fd.write('hello\nworld\n')

        python2 = os.path.join(self.tempdir, 'd')
        with open(python2, 'w') as fd:
            fd.write('#!/usr/bin/env python2\n')

        python3 = os.path.join(self.tempdir, 'e')
        with open(python3, 'w') as fd:
            fd.write('#!/usr/bin/env python3\n')

        pythonw = os.path.join(self.tempdir, 'f')
        with open(pythonw, 'w') as fd:
            fd.write('#!/usr/bin/env pythonw\n')

        self.assertEqual(
            sorted(iterSourceCode([self.tempdir])),
            sorted([python, python2, python3, pythonw]))
开发者ID:Khan,项目名称:khan-linter,代码行数:29,代码来源:test_api.py


示例4: _check_recursive

def _check_recursive(paths, reporter):
    """
    The builtin recursive checker tries to check .pyc files.
    """
    num_warnings = 0
    for path in api.iterSourceCode(paths):
        if path.endswith('.py'):
            num_warnings += api.checkPath(path, reporter)
    return num_warnings
开发者ID:360yln,项目名称:django-cms-2.4,代码行数:9,代码来源:static_analysis.py


示例5: run

    def run(self):
        reporter = ProspectorReporter(ignore=self.ignore_codes)

        for filepath in iterSourceCode(self._paths):
            if any([ip.search(filepath) for ip in self._ignores]):
                continue

            checkPath(filepath, reporter)

        return reporter.get_messages()
开发者ID:marciusvinicius,项目名称:prospector,代码行数:10,代码来源:__init__.py


示例6: test_recurses

 def test_recurses(self):
     """
     If the Python files are hidden deep down in child directories, we will
     find them.
     """
     os.mkdir(os.path.join(self.tempdir, "foo"))
     apath = self.makeEmptyFile("foo", "a.py")
     os.mkdir(os.path.join(self.tempdir, "bar"))
     bpath = self.makeEmptyFile("bar", "b.py")
     cpath = self.makeEmptyFile("c.py")
     self.assertEqual(sorted(iterSourceCode([self.tempdir])), sorted([apath, bpath, cpath]))
开发者ID:yamatogun,项目名称:pyflakes,代码行数:11,代码来源:test_api.py


示例7: test_multipleDirectories

 def test_multipleDirectories(self):
     """
     L{iterSourceCode} can be given multiple directories.  It will recurse
     into each of them.
     """
     foopath = os.path.join(self.tempdir, "foo")
     barpath = os.path.join(self.tempdir, "bar")
     os.mkdir(foopath)
     apath = self.makeEmptyFile("foo", "a.py")
     os.mkdir(barpath)
     bpath = self.makeEmptyFile("bar", "b.py")
     self.assertEqual(sorted(iterSourceCode([foopath, barpath])), sorted([apath, bpath]))
开发者ID:yamatogun,项目名称:pyflakes,代码行数:12,代码来源:test_api.py


示例8: test_recurses

 def test_recurses(self):
     """
     If the Python files are hidden deep down in child directories, we will
     find them.
     """
     os.mkdir(os.path.join(self.tempdir, 'foo'))
     apath = self.makeEmptyFile('foo', 'a.py')
     os.mkdir(os.path.join(self.tempdir, 'bar'))
     bpath = self.makeEmptyFile('bar', 'b.py')
     cpath = self.makeEmptyFile('c.py')
     self.assertEqual(
         sorted(iterSourceCode([self.tempdir])),
         sorted([apath, bpath, cpath]))
开发者ID:liangsuilong,项目名称:pyflakes,代码行数:13,代码来源:test_api.py


示例9: test_emptyDirectory

 def test_emptyDirectory(self):
     """
     There are no Python files in an empty directory.
     """
     self.assertEqual(list(iterSourceCode([self.tempdir])), [])
开发者ID:liangsuilong,项目名称:pyflakes,代码行数:5,代码来源:test_api.py


示例10: test_onlyPythonSource

 def test_onlyPythonSource(self):
     """
     Files that are not Python source files are not included.
     """
     self.makeEmptyFile('foo.pyc')
     self.assertEqual(list(iterSourceCode([self.tempdir])), [])
开发者ID:liangsuilong,项目名称:pyflakes,代码行数:6,代码来源:test_api.py


示例11:

"""
开发者ID:letouriste001,项目名称:SmartForest_2.0,代码行数:1,代码来源:test_api.py



注:本文中的pyflakes.api.iterSourceCode函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python reporter.Reporter类代码示例发布时间:2022-05-25
下一篇:
Python pyflagsh.shell_execv函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap