python: Remove Python 2.7 compatibility code
We don't support Python 2.7 anymore. Remove glue code like the six
dependency and "from __future__" imports from gem5's standard library.
Change-Id: I71834c325f86ff0329b222be87794ead96081f05
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39584
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
diff --git a/src/python/m5/util/grammar.py b/src/python/m5/util/grammar.py
index e09c989..9aba746 100644
--- a/src/python/m5/util/grammar.py
+++ b/src/python/m5/util/grammar.py
@@ -25,7 +25,6 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import os
-from six import string_types
import ply.lex
import ply.yacc
@@ -94,7 +93,7 @@
"'%s' object has no attribute '%s'" % (type(self), attr))
def parse_string(self, data, source='<string>', debug=None, tracking=0):
- if not isinstance(data, string_types):
+ if not isinstance(data, str):
raise AttributeError(
"argument must be a string, was '%s'" % type(f))
@@ -113,7 +112,7 @@
return result
def parse_file(self, f, **kwargs):
- if isinstance(f, string_types):
+ if isinstance(f, str):
source = f
f = open(f, 'r')
elif isinstance(f, file):