From a6b52c11468e8b78e0ed696da93d5db032cf8827 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: May 13 2020 19:16:24 +0000 Subject: Adjust pagure's source code for the newer flake8 Signed-off-by: Pierre-Yves Chibon --- diff --git a/.flake8 b/.flake8 index c5a822c..af7613a 100644 --- a/.flake8 +++ b/.flake8 @@ -1,3 +1,3 @@ [flake8] -ignore = W503,E203 +ignore = W503,E203,E902 exclude = pagure/hooks/files/git_multimail_upstream.py diff --git a/pagure/api/__init__.py b/pagure/api/__init__.py index 9a84c9d..37559bf 100644 --- a/pagure/api/__init__.py +++ b/pagure/api/__init__.py @@ -33,7 +33,7 @@ API = flask.Blueprint("api_ns", __name__, url_prefix="/api/0") import pagure.lib.query # noqa: E402 import pagure.lib.tasks # noqa: E402 from pagure.config import config as pagure_config # noqa: E402 -from pagure.doc_utils import ( +from pagure.doc_utils import ( # noqa: E402 load_doc_title_and_name, modify_rst, modify_html, diff --git a/pagure/lib/git_auth.py b/pagure/lib/git_auth.py index 97a3abc..92bb4ea 100644 --- a/pagure/lib/git_auth.py +++ b/pagure/lib/git_auth.py @@ -704,11 +704,11 @@ class Gitolite2Auth(GitAuthHelper): of lines as returned by _process_project. """ repos = [] - for l in lines: - if l.startswith("repo "): - repos.append([l]) + for line in lines: + if line.startswith("repo "): + repos.append([line]) else: - repos[-1].append(l) + repos[-1].append(line) for i, repo_lines in enumerate(repos): repos[i] = "\n".join(repo_lines) return repos diff --git a/pagure/ui/filters.py b/pagure/ui/filters.py index 933f0bb..f20ea4e 100644 --- a/pagure/ui/filters.py +++ b/pagure/ui/filters.py @@ -374,7 +374,12 @@ def format_loc( "%(comment)s" "" "" - "" + "" + '" + "" "" % ( { diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py index 93f5c65..5b522b5 100644 --- a/pagure/ui/repo.py +++ b/pagure/ui/repo.py @@ -847,7 +847,7 @@ def view_history_file(repo, filename, username=None, namespace=None): fromref=branchname, ) if log.strip(): - log = [l.split(" ", 1) for l in log.strip().split("\n")] + log = [line.split(" ", 1) for line in log.strip().split("\n")] else: log = [] except Exception: diff --git a/tests/test_style.py b/tests/test_style.py index c7ea0fa..5c9b81c 100644 --- a/tests/test_style.py +++ b/tests/test_style.py @@ -41,7 +41,7 @@ class TestStyle(unittest.TestCase): sys.executable, "-m", "flake8", - "--ignore=E712,W503,E203", + "--ignore=E712,W503,E203,E902", REPO_PATH, ]