From 1fb57aae67ebf0026f4f124a9dda1fff5223932d Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Sat, 4 Apr 2020 10:55:41 +0200 Subject: [PATCH] Remove usage of six The repo is python 3 only now, we can remove six usage and assume python3 everywhere. Change-Id: I0c742c2c7898914fae48b675e53c4dafb358bf9a --- hacking/checks/except_checks.py | 10 +--------- hacking/config.py | 4 ++-- hacking/tests/test_doctest.py | 3 +-- lower-constraints.txt | 1 - requirements.txt | 1 - 5 files changed, 4 insertions(+), 15 deletions(-) diff --git a/hacking/checks/except_checks.py b/hacking/checks/except_checks.py index fc61264..029ae55 100644 --- a/hacking/checks/except_checks.py +++ b/hacking/checks/except_checks.py @@ -15,8 +15,6 @@ import ast import re -from six import PY2 - from hacking import core RE_ASSERT_RAISES_EXCEPTION = re.compile(r"self\.assertRaises\(Exception[,\)]") @@ -61,13 +59,7 @@ def hacking_except_format_assert(logical_line, noqa): def is_none(node): - '''Check whether an AST node corresponds to None. - - In Python 2 None uses the same ast.Name class that variables etc. use, - but in Python 3 there is a new ast.NameConstant class. - ''' - if PY2: - return isinstance(node, ast.Name) and node.id == 'None' + '''Check whether an AST node corresponds to None.''' return isinstance(node, ast.NameConstant) and node.value is None diff --git a/hacking/config.py b/hacking/config.py index 79e3503..d4f572c 100644 --- a/hacking/config.py +++ b/hacking/config.py @@ -11,12 +11,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -from six import moves +import configparser class Config(object): def __init__(self, default_section=None, tox_file='tox.ini'): - conf = moves.configparser.RawConfigParser() + conf = configparser.RawConfigParser() conf.read(tox_file) self.conf = conf diff --git a/hacking/tests/test_doctest.py b/hacking/tests/test_doctest.py index e3e0a48..70f44ac 100644 --- a/hacking/tests/test_doctest.py +++ b/hacking/tests/test_doctest.py @@ -20,7 +20,6 @@ import sys import tempfile import pkg_resources -import six import testscenarios from testtools import content @@ -75,7 +74,7 @@ def load_tests(loader, tests, pattern): continue check = entry.load() - if check.skip_on_py3 and six.PY3: + if check.skip_on_py3: continue name = entry.attrs[0] diff --git a/lower-constraints.txt b/lower-constraints.txt index 600340b..df29668 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -22,7 +22,6 @@ pytz==2013.6 PyYAML==3.12 reno==2.5.0 requests==2.14.2 -six==1.10.0 snowballstemmer==1.2.1 stestr==2.0.0 testscenarios==0.4 diff --git a/requirements.txt b/requirements.txt index bd5cd43..366205d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1 @@ flake8<4.0.0,>=3.6.0 # MIT -six>=1.10.0 # MIT