def pep8(self, *args): del sys.stdout[:], sys.stderr[:] sys.argv[1:] = args try: pycodestyle._main() errorcode = None except SystemExit: errorcode = sys.exc_info()[1].code return sys.stdout.getvalue(), sys.stderr.getvalue(), errorcode
def pycodestyle(self, *args): del sys.stdout[:], sys.stderr[:] sys.argv[1:] = args try: pycodestyle._main() errorcode = None except SystemExit: errorcode = sys.exc_info()[1].code return sys.stdout.getvalue(), sys.stderr.getvalue(), errorcode
def style() -> Tuple[int, str, str]: """Runs pycodestyle, unpleasantly white-boxy call. ..but it doesn't seem to be written for integration, so: """ print(' pycodestyle...') code = 0 warn, err = io.StringIO(), io.StringIO() with state(sys, argv=[], stdout=warn, stderr=err): try: pycodestyle._main() except SystemExit as exc: code = exc.code return code, warn.getvalue(), err.getvalue()
# Copyright 2020 Massachusetts Institute of Technology. # Licensed under the BSD 3-Clause License. See LICENSE.TXT for details. import re import sys from pycodestyle import _main if __name__ == '__main__': sys.argv[0] = re.sub(r"_script\.py$", "", sys.argv[0]) sys.exit(_main())
import pycodestyle if __name__ == '__main__': pycodestyle._main()