Skip to content

Commit d724c35

Browse files
committed
[benchmark] Remove Python 2 logic
Found a few pieces of Python 2 code. Remove them since we are on Python 3 entirely.
1 parent 069653d commit d724c35

File tree

3 files changed

+3
-17
lines changed

3 files changed

+3
-17
lines changed

benchmark/scripts/Benchmark_Driver

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,7 @@ class MarkdownReportHandler(logging.StreamHandler):
408408
msg = self.format(record)
409409
stream = self.stream
410410
try:
411-
# In Python 2 Unicode strings have a special type
412-
unicode_type = unicode
413-
except NameError:
414-
unicode_type = str
415-
try:
416-
if isinstance(msg, unicode_type) and getattr(stream, "encoding", None):
411+
if isinstance(msg, str) and getattr(stream, "encoding", None):
417412
stream.write(msg.encode(stream.encoding))
418413
else:
419414
stream.write(msg)

benchmark/scripts/test_Benchmark_Driver.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,7 @@
1818
import sys
1919
import time
2020
import unittest
21-
22-
try:
23-
# for Python 2
24-
from StringIO import StringIO
25-
except ImportError:
26-
# for Python 3
27-
from io import StringIO
21+
from io import StringIO
2822

2923
from compare_perf_tests import PerformanceTestResult
3024

benchmark/scripts/test_utils.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@
2424

2525
import logging
2626
import sys
27-
try:
28-
from StringIO import StringIO # for Python 2
29-
except ImportError:
30-
from io import StringIO # for Python 3
3127
from contextlib import contextmanager
28+
from io import StringIO
3229

3330

3431
@contextmanager

0 commit comments

Comments
 (0)