Skip to content

[benchmark] Remove Python 2 logic #42048

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions benchmark/scripts/Benchmark_Driver
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,7 @@ class MarkdownReportHandler(logging.StreamHandler):
msg = self.format(record)
stream = self.stream
try:
# In Python 2 Unicode strings have a special type
unicode_type = unicode
except NameError:
unicode_type = str
try:
if isinstance(msg, unicode_type) and getattr(stream, "encoding", None):
if isinstance(msg, str) and getattr(stream, "encoding", None):
stream.write(msg.encode(stream.encoding))
else:
stream.write(msg)
Expand Down
8 changes: 1 addition & 7 deletions benchmark/scripts/test_Benchmark_Driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@
import sys
import time
import unittest

try:
# for Python 2
from StringIO import StringIO
except ImportError:
# for Python 3
from io import StringIO
from io import StringIO

from compare_perf_tests import PerformanceTestResult

Expand Down
5 changes: 1 addition & 4 deletions benchmark/scripts/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@

import logging
import sys
try:
from StringIO import StringIO # for Python 2
except ImportError:
from io import StringIO # for Python 3
from contextlib import contextmanager
from io import StringIO


@contextmanager
Expand Down