diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..ec083d6 --- /dev/null +++ b/.flake8 @@ -0,0 +1,5 @@ +[flake8] +ignore = W293,E301,E271,E265,W291,E722,E302,C901,E225,E128,E122,E226,E231 +max-line-length = 160 +exclude = tests/* +max-complexity = 10 diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 1dc6d84..2778805 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -23,8 +23,11 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install mypy + pip install mypy pyflakes flake8 - name: Lint with mypy run: | mypy IPython/terminal/ptutils.py mypy IPython/core/c*.py + - name: Lint with pyflakes + run: | + flake8 IPython/core/magics/script.py diff --git a/IPython/core/magics/script.py b/IPython/core/magics/script.py index 02b0286..a885e3f 100644 --- a/IPython/core/magics/script.py +++ b/IPython/core/magics/script.py @@ -18,7 +18,6 @@ from IPython.core.magic import ( Magics, magics_class, line_magic, cell_magic ) from IPython.lib.backgroundjobs import BackgroundJobManager -from IPython.utils import py3compat from IPython.utils.process import arg_split from traitlets import List, Dict, default @@ -139,7 +138,7 @@ class ScriptMagics(Magics): def named_script_magic(line, cell): # if line, add it as cl-flags if line: - line = "%s %s" % (script, line) + line = "%s %s" % (script, line) else: line = script return self.shebang(line, cell) @@ -262,8 +261,7 @@ class ScriptMagics(Magics): except OSError: pass except Exception as e: - print("Error while terminating subprocess (pid=%i): %s" \ - % (p.pid, e)) + print("Error while terminating subprocess (pid=%i): %s" % (p.pid, e)) return if args.raise_error and p.returncode!=0: raise CalledProcessError(p.returncode, cell) diff --git a/MANIFEST.in b/MANIFEST.in index 5bc59b9..ec33beb 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -7,6 +7,7 @@ include MANIFEST.in include pytest.ini include mypy.ini include .mailmap +include .flake8 recursive-exclude tools * exclude tools