예제 #1
0
 def __try_pychecker(self):
     try:
         import pychecker
         sys.argv = '''pychecker pymodbus/*.py'''.split()
         main()
         return True
     except: return False
예제 #2
0
 def __try_pylint(self):
     try:
         import pylint
         sys.argv = '''pylint cakery/*.py'''.split()
         main()
         return True
     except: return False
예제 #3
0
 def __try_pyflakes(self):
     try:
         from pyflakes.scripts.pyflakes import main
         sys.argv = '''pyflakes pymodbus'''.split()
         main()
         return True
     except: return False
예제 #4
0
 def __run_python3(self):
     try:
         from lib2to3.main import main
         sys.argv = ['2to3'] + self.directories
         main("lib2to3.fixes")
         return True
     except: return False
예제 #5
0
 def _try_pylint(self):
     try:
         import pylint
         sys.argv = """pylint pymodbus/*.py""".split()
         main()
         return True
     except: return False
예제 #6
0
 def __run_pep8(self):
     try:
         from pep8 import _main as main
         sys.argv = '''pep8 --repeat --count --statistics
         '''.split() + self.directories
         main()
         return True
     except: return False
예제 #7
0
 def _try_pyflakes(self):
     try:
         from pyflakes.scripts.pyflakes import main
         sys.argv = """pyflakes pymodbus""".split()
         main()
         return True
     except Exception:
         return False
예제 #8
0
 def __try_pylint(self):
     try:
         import pylint
         sys.argv = '''pylint pymodbus3/*.py'''.split()
         main()
         return True
     except:
         return False
예제 #9
0
 def _run_pep8(self):
     try:
         from pep8 import _main as main
         sys.argv = """pep8 --repeat --count --statistics
         """.split() + self.directories
         main()
         return True
     except Exception:
         return False
예제 #10
0
from pyflakes.scripts import pyflakes
from pyflakes.checker import Checker


def report_with_bypass(self, messageClass, *args, **kwargs):
    text_lineno = args[0] - 1
    with open(self.filename, 'r') as code:
        if code.readlines()[text_lineno].find('pyflakes_bypass') >= 0:
            return
    self.messages.append(messageClass(self.filename, *args, **kwargs))


# monkey patch checker to support bypass
Checker.report = report_with_bypass

pyflakes.main()
예제 #11
0
#!/usr/bin/env python

from pyflakes.scripts.pyflakes import main
main()
예제 #12
0
"""
 wrapper for pyflakes to ignore gettext based warning:
     "undefined name '_'"

 From https://bugs.launchpad.net/pyflakes/+bug/844592
"""
import __builtin__
import os
import sys

from pyflakes.scripts.pyflakes import main

if __name__ == "__main__":
    names = os.environ.get('PYFLAKES_BUILTINS', '_')
    names = [x.strip() for x in names.split(',')]
    for x in names:
        if not hasattr(__builtin__, x):
            setattr(__builtin__, x, True)

    del names, os, __builtin__

    sys.exit(main())
예제 #13
0
#!/usr/bin/env python

# see http://chase-seibert.github.io/blog/2013/01/11/bypass_pyflakes.html

from pyflakes.scripts import pyflakes
from pyflakes.checker import Checker

def report_with_bypass(self, messageClass, *args, **kwargs):
    text_lineno = args[0].lineno - 1
    with open(self.filename, 'r') as code:
        if code.readlines()[text_lineno].find('# NOQA') >= 0:
            return
    self.messages.append(messageClass(self.filename, *args, **kwargs))

def abc():
    m=n

# monkey patch checker to support bypass
Checker.report = report_with_bypass

pyflakes.main()
예제 #14
0
파일: flakes.py 프로젝트: hfeeki/nova
"""
 wrapper for pyflakes to ignore gettext based warning:
     "undefined name '_'"

 From https://bugs.launchpad.net/pyflakes/+bug/844592
"""
import __builtin__
import os
import sys

from pyflakes.scripts import pyflakes

if __name__ == "__main__":
    names = os.environ.get('PYFLAKES_BUILTINS', '_')
    names = [x.strip() for x in names.split(',')]
    for x in names:
        if not hasattr(__builtin__, x):
            setattr(__builtin__, x, True)

    del names, os, __builtin__

    sys.exit(pyflakes.main())
예제 #15
0
"""
 wrapper for pyflakes to ignore gettext based warning:
     "undefined name '_'"

 Synced in from openstack-common
"""
import sys

import pyflakes.checker
from pyflakes.scripts import pyflakes

if __name__ == "__main__":
    orig_builtins = set(pyflakes.checker._MAGIC_GLOBALS)
    pyflakes.checker._MAGIC_GLOBALS = orig_builtins | set(['_'])
    sys.exit(pyflakes.main())
예제 #16
0
"""
 wrapper for pyflakes to ignore gettext based warning:
     "undefined name '_'"

 Synced in from openstack-common
"""
import sys

import pyflakes.checker
from pyflakes.scripts.pyflakes import main

if __name__ == "__main__":
    orig_builtins = set(pyflakes.checker._MAGIC_GLOBALS)
    pyflakes.checker._MAGIC_GLOBALS = orig_builtins | set(['_'])
    sys.exit(main())
예제 #17
0
#!/usr/bin/python

import sys
from pyflakes.scripts.pyflakes import main
sys.exit(main(sys.argv[1:]))
예제 #18
0
                return self.handleChildren(tree)

            for chunk in tree.args[1:]:
                chunk_cls = chunk.__class__.__name__
                if chunk_cls.upper() not in ('STR', 'UNICODE'):
                    self.report(
                        BadDemandloadCall, chunk.lineno,
                        "invoked with non string/unicode arg: %r" %
                        (chunk_cls, ))
                    continue
                s = chunk.s
                try:
                    targets = list(parse_demandload([s]))
                except ValueError, ve:
                    self.report(BadDemandloadCall, chunk.lineno, ve)
                    continue
                for src, asname in targets:
                    fakenode = _ast.copy_location(
                        compile("import %s as %s\n" % (src, asname),
                                self.filename, "exec",
                                _ast.PyCF_ONLY_AST).body[0], chunk)
                    self.addBinding(chunk.lineno,
                                    DemandloadImportation(asname, fakenode))
        return self.handleChildren(tree)


if __name__ == '__main__':
    _checker.Checker = DemandloadChecker
    from pyflakes.scripts.pyflakes import main
    main()