Remove usage of six

The repo is python 3 only now, we can remove six usage and assume
python3 everywhere.

Change-Id: I0c742c2c7898914fae48b675e53c4dafb358bf9a
This commit is contained in:
Andreas Jaeger
2020-04-04 10:55:41 +02:00
committed by Radosław Piliszek
parent 1c45c8cd60
commit 1fb57aae67
5 changed files with 4 additions and 15 deletions

View File

@@ -15,8 +15,6 @@
import ast import ast
import re import re
from six import PY2
from hacking import core from hacking import core
RE_ASSERT_RAISES_EXCEPTION = re.compile(r"self\.assertRaises\(Exception[,\)]") 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): def is_none(node):
'''Check whether an AST node corresponds to None. '''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'
return isinstance(node, ast.NameConstant) and node.value is None return isinstance(node, ast.NameConstant) and node.value is None

View File

@@ -11,12 +11,12 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from six import moves import configparser
class Config(object): class Config(object):
def __init__(self, default_section=None, tox_file='tox.ini'): def __init__(self, default_section=None, tox_file='tox.ini'):
conf = moves.configparser.RawConfigParser() conf = configparser.RawConfigParser()
conf.read(tox_file) conf.read(tox_file)
self.conf = conf self.conf = conf

View File

@@ -20,7 +20,6 @@ import sys
import tempfile import tempfile
import pkg_resources import pkg_resources
import six
import testscenarios import testscenarios
from testtools import content from testtools import content
@@ -75,7 +74,7 @@ def load_tests(loader, tests, pattern):
continue continue
check = entry.load() check = entry.load()
if check.skip_on_py3 and six.PY3: if check.skip_on_py3:
continue continue
name = entry.attrs[0] name = entry.attrs[0]

View File

@@ -22,7 +22,6 @@ pytz==2013.6
PyYAML==3.12 PyYAML==3.12
reno==2.5.0 reno==2.5.0
requests==2.14.2 requests==2.14.2
six==1.10.0
snowballstemmer==1.2.1 snowballstemmer==1.2.1
stestr==2.0.0 stestr==2.0.0
testscenarios==0.4 testscenarios==0.4

View File

@@ -1,2 +1 @@
flake8<4.0.0,>=3.6.0 # MIT flake8<4.0.0,>=3.6.0 # MIT
six>=1.10.0 # MIT