From 1abdbcb0a3f6bf9ca3fbd5d111940906ff161e7e Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Thu, 3 Dec 2020 15:21:27 -0600 Subject: [PATCH 1/2] remove all python version checks and only keep code from python >= 3.6 code paths --- ci/edmtool.py | 6 +----- enable/tests/primitives/test_image.py | 5 +---- kiva/fonttools/font.py | 5 ----- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/ci/edmtool.py b/ci/edmtool.py index 866d58762..78f4f64aa 100644 --- a/ci/edmtool.py +++ b/ci/edmtool.py @@ -135,11 +135,7 @@ 'null': {'ETS_TOOLKIT': 'null.image'}, } -if sys.version_info < (3, 0): - import string - pillow_trans = string.maketrans('<=>', '___') -else: - pillow_trans = ''.maketrans({'<': '_', '=': '_', '>': '_'}) +pillow_trans = ''.maketrans({'<': '_', '=': '_', '>': '_'}) if sys.platform == 'darwin': dependencies.add('Cython') diff --git a/enable/tests/primitives/test_image.py b/enable/tests/primitives/test_image.py index 4617ce7ba..f8204f8cf 100644 --- a/enable/tests/primitives/test_image.py +++ b/enable/tests/primitives/test_image.py @@ -5,10 +5,7 @@ import six -if sys.version_info[:2] == (2, 6): - import unittest2 as unittest -else: - import unittest +import unittest import numpy as np from numpy.testing import assert_array_equal diff --git a/kiva/fonttools/font.py b/kiva/fonttools/font.py index 4a82b98f2..bf98be780 100644 --- a/kiva/fonttools/font.py +++ b/kiva/fonttools/font.py @@ -86,11 +86,6 @@ def __init__(self, face_name="", size=12, family=SWISS, weight=NORMAL, (type(underline) != int) or (not isinstance(face_name, six.string_types)) or \ (type(encoding) != type(DEFAULT)): raise RuntimeError("Bad value in Font() constructor.") - ### HACK: C++ stuff expects a string (not unicode) for the face_name, so fix - ### if needed. - ### Only for python < 3 - if six.PY2 and isinstance(face_name, six.text_type): - face_name = face_name.encode("latin1") self.size = size self.family = family self.weight = weight From be9d0ff02a02ed243f1e7c52eba2010ffabd479c Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Fri, 4 Dec 2020 07:46:02 -0600 Subject: [PATCH 2/2] rearrange import order for style --- enable/tests/primitives/test_image.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/enable/tests/primitives/test_image.py b/enable/tests/primitives/test_image.py index f8204f8cf..36acc60e8 100644 --- a/enable/tests/primitives/test_image.py +++ b/enable/tests/primitives/test_image.py @@ -2,11 +2,10 @@ import os import sys +import unittest import six -import unittest - import numpy as np from numpy.testing import assert_array_equal from pkg_resources import resource_filename