summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Stapleton Cordasco <graffatcolmingov@gmail.com>2019-02-17 15:22:44 +0000
committerIan Stapleton Cordasco <graffatcolmingov@gmail.com>2019-02-17 15:22:44 +0000
commit2170f54cb35d790dc30ef1687a03b599e17fab04 (patch)
treebb17cba2a2d4615f52f16370acc94261dc564f8f
parent684ffb3306af89e4092c4598aa9ae4294eb52eb8 (diff)
parenta252a0b1386ee815833f2edae0ffa45aa23032ac (diff)
downloadflake8-2170f54cb35d790dc30ef1687a03b599e17fab04.tar.gz
Merge branch 'less_monkeypatch' into 'master'
Remove pyflakes monkeypatching See merge request pycqa/flake8!306
-rw-r--r--src/flake8/plugins/pyflakes.py12
1 files changed, 1 insertions, 11 deletions
diff --git a/src/flake8/plugins/pyflakes.py b/src/flake8/plugins/pyflakes.py
index d4556c5..2f233c4 100644
--- a/src/flake8/plugins/pyflakes.py
+++ b/src/flake8/plugins/pyflakes.py
@@ -53,16 +53,6 @@ FLAKE8_PYFLAKES_CODES = {
}
-def patch_pyflakes():
- """Add error codes to Pyflakes messages."""
- for name, obj in vars(pyflakes.messages).items():
- if name[0].isupper() and obj.message:
- obj.flake8_code = FLAKE8_PYFLAKES_CODES.get(name, "F999")
-
-
-patch_pyflakes()
-
-
class FlakesChecker(pyflakes.checker.Checker):
"""Subclass the Pyflakes checker to conform with the flake8 API."""
@@ -186,7 +176,7 @@ class FlakesChecker(pyflakes.checker.Checker):
message.lineno,
col,
"{} {}".format(
- message.flake8_code,
+ FLAKE8_PYFLAKES_CODES.get(type(message).__name__, "F999"),
message.message % message.message_args,
),
message.__class__,