def __try_pychecker(self): try: import pychecker sys.argv = '''pychecker pymodbus/*.py'''.split() main() return True except: return False
def __try_pylint(self): try: import pylint sys.argv = '''pylint cakery/*.py'''.split() main() return True except: return False
def __try_pyflakes(self): try: from pyflakes.scripts.pyflakes import main sys.argv = '''pyflakes pymodbus'''.split() main() return True except: return False
def __run_python3(self): try: from lib2to3.main import main sys.argv = ['2to3'] + self.directories main("lib2to3.fixes") return True except: return False
def _try_pylint(self): try: import pylint sys.argv = """pylint pymodbus/*.py""".split() main() return True except: return False
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
def _try_pyflakes(self): try: from pyflakes.scripts.pyflakes import main sys.argv = """pyflakes pymodbus""".split() main() return True except Exception: return False
def __try_pylint(self): try: import pylint sys.argv = '''pylint pymodbus3/*.py'''.split() main() return True except: return False
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
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()
#!/usr/bin/env python from pyflakes.scripts.pyflakes import main main()
""" 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())
#!/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()
""" 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())
""" 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())
""" 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())
#!/usr/bin/python import sys from pyflakes.scripts.pyflakes import main sys.exit(main(sys.argv[1:]))
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()