summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2022-10-18 08:56:45 -0400
committerGitHub <noreply@github.com>2022-10-18 08:56:45 -0400
commite119507f6322a69a4c4a228cf6793b2c01eb8ce0 (patch)
tree953988343a398b0a5f53fb88730bf6ed39ebb2bf
parente9c846d03768ff12267569c77aba935f96827d31 (diff)
parent80c5a50ccfb2fba29594901c02b5a9c4689f7f92 (diff)
downloadpep8-e119507f6322a69a4c4a228cf6793b2c01eb8ce0.tar.gz
Merge pull request #1111 from dannysepler/delete-py3-warnings
Delete W601 -> W604 warnings
-rw-r--r--README.rst4
-rw-r--r--docs/intro.rst12
-rwxr-xr-xpycodestyle.py53
-rw-r--r--testsuite/W60.py15
4 files changed, 0 insertions, 84 deletions
diff --git a/README.rst b/README.rst
index c71b933..2f6ddb8 100644
--- a/README.rst
+++ b/README.rst
@@ -65,11 +65,9 @@ Example usage and output
optparse.py:69:11: E401 multiple imports on one line
optparse.py:77:1: E302 expected 2 blank lines, found 1
optparse.py:88:5: E301 expected 1 blank line, found 0
- optparse.py:222:34: W602 deprecated form of raising exception
optparse.py:347:31: E211 whitespace before '('
optparse.py:357:17: E201 whitespace after '{'
optparse.py:472:29: E221 multiple spaces before operator
- optparse.py:544:21: W601 .has_key() is deprecated, use 'in'
You can also make ``pycodestyle.py`` show the source code for each error, and
even the relevant text from PEP 8::
@@ -97,8 +95,6 @@ Or you can display how often each error was found::
165 E303 too many blank lines (4)
325 E401 multiple imports on one line
3615 E501 line too long (82 characters)
- 612 W601 .has_key() is deprecated, use 'in'
- 1188 W602 deprecated form of raising exception
Links
-----
diff --git a/docs/intro.rst b/docs/intro.rst
index 3be9d8e..aba8a15 100644
--- a/docs/intro.rst
+++ b/docs/intro.rst
@@ -71,11 +71,9 @@ Example usage and output
optparse.py:69:11: E401 multiple imports on one line
optparse.py:77:1: E302 expected 2 blank lines, found 1
optparse.py:88:5: E301 expected 1 blank line, found 0
- optparse.py:222:34: W602 deprecated form of raising exception
optparse.py:347:31: E211 whitespace before '('
optparse.py:357:17: E201 whitespace after '{'
optparse.py:472:29: E221 multiple spaces before operator
- optparse.py:544:21: W601 .has_key() is deprecated, use 'in'
You can also make ``pycodestyle.py`` show the source code for each error, and
even the relevant text from PEP 8::
@@ -103,8 +101,6 @@ Or you can display how often each error was found::
165 E303 too many blank lines (4)
325 E401 multiple imports on one line
3615 E501 line too long (82 characters)
- 612 W601 .has_key() is deprecated, use 'in'
- 1188 W602 deprecated form of raising exception
You can also make ``pycodestyle.py`` show the error text in different formats by
using ``--format`` having options default/pylint/custom::
@@ -415,14 +411,6 @@ This is the current list of error and warning codes:
+------------+----------------------------------------------------------------------+
| **W6** | *Deprecation warning* |
+------------+----------------------------------------------------------------------+
-| W601 | .has_key() is deprecated, use 'in' |
-+------------+----------------------------------------------------------------------+
-| W602 | deprecated form of raising exception |
-+------------+----------------------------------------------------------------------+
-| W603 | '<>' is deprecated, use '!=' |
-+------------+----------------------------------------------------------------------+
-| W604 | backticks are deprecated, use 'repr()' |
-+------------+----------------------------------------------------------------------+
| W605 | invalid escape sequence '\x' |
+------------+----------------------------------------------------------------------+
| W606 | 'async' and 'await' are reserved keywords starting with Python 3.7 |
diff --git a/pycodestyle.py b/pycodestyle.py
index 2119d06..4a02ff2 100755
--- a/pycodestyle.py
+++ b/pycodestyle.py
@@ -1564,59 +1564,6 @@ def ambiguous_identifier(logical_line, tokens):
@register_check
-def python_3000_has_key(logical_line, noqa):
- r"""The {}.has_key() method is removed in Python 3: use the 'in'
- operator.
-
- Okay: if "alph" in d:\n print d["alph"]
- W601: assert d.has_key('alph')
- """
- pos = logical_line.find('.has_key(')
- if pos > -1 and not noqa:
- yield pos, "W601 .has_key() is deprecated, use 'in'"
-
-
-@register_check
-def python_3000_raise_comma(logical_line):
- r"""When raising an exception, use "raise ValueError('message')".
-
- The older form is removed in Python 3.
-
- Okay: raise DummyError("Message")
- W602: raise DummyError, "Message"
- """
- match = RAISE_COMMA_REGEX.match(logical_line)
- if match and not RERAISE_COMMA_REGEX.match(logical_line):
- yield match.end() - 1, "W602 deprecated form of raising exception"
-
-
-@register_check
-def python_3000_not_equal(logical_line):
- r"""New code should always use != instead of <>.
-
- The older syntax is removed in Python 3.
-
- Okay: if a != 'no':
- W603: if a <> 'no':
- """
- pos = logical_line.find('<>')
- if pos > -1:
- yield pos, "W603 '<>' is deprecated, use '!='"
-
-
-@register_check
-def python_3000_backticks(logical_line):
- r"""Use repr() instead of backticks in Python 3.
-
- Okay: val = repr(1 + 2)
- W604: val = `1 + 2`
- """
- pos = logical_line.find('`')
- if pos > -1:
- yield pos, "W604 backticks are deprecated, use 'repr()'"
-
-
-@register_check
def python_3000_invalid_escape_sequence(logical_line, tokens, noqa):
r"""Invalid escape sequences are deprecated in Python 3.6.
diff --git a/testsuite/W60.py b/testsuite/W60.py
index 5003677..f44552d 100644
--- a/testsuite/W60.py
+++ b/testsuite/W60.py
@@ -1,18 +1,3 @@
-#: W601
-if a.has_key("b"):
- print a
-#: W602
-raise DummyError, "Message"
-#: W602
-raise ValueError, "hello %s %s" % (1, 2)
-#: Okay
-raise type_, val, tb
-raise Exception, Exception("f"), t
-#: W603
-if x <> 0:
- x = 0
-#: W604
-val = `1 + 2`
#: W605:1:10
regex = '\.png$'
#: W605:2:1