From 370f58f4fa96e5752c2b0cae5838b97a49dd2a71 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 17 Jun 2020 17:21:41 +0800 Subject: [PATCH] teuthology/task: drop six.string_types Signed-off-by: Kefu Chai --- teuthology/task/__init__.py | 4 +--- teuthology/task/mpi.py | 3 +-- teuthology/task/pcp.py | 7 ++----- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/teuthology/task/__init__.py b/teuthology/task/__init__.py index 7bbf6c5e8b..eb1d04c8b8 100644 --- a/teuthology/task/__init__.py +++ b/teuthology/task/__init__.py @@ -1,7 +1,5 @@ import logging -from six import string_types as basestring - from teuthology.misc import deep_merge from teuthology.orchestra.cluster import Cluster @@ -76,7 +74,7 @@ class Task(object): if len(role_matches.remotes) > 0: for (remote, roles) in role_matches.remotes.items(): cluster.add(remote, roles) - elif isinstance(host_spec, basestring): + elif isinstance(host_spec, str): for (remote, roles) in self.ctx.cluster.remotes.items(): if remote.name.split('@')[-1] == host_spec or \ remote.shortname == host_spec: diff --git a/teuthology/task/mpi.py b/teuthology/task/mpi.py index eaeb5d6bd5..ade4a5ccec 100644 --- a/teuthology/task/mpi.py +++ b/teuthology/task/mpi.py @@ -5,7 +5,6 @@ import logging import re from teuthology import misc as teuthology -from six import string_types as basestring log = logging.getLogger(__name__) @@ -92,7 +91,7 @@ def task(ctx, config): remotes = [] master_remote = None if 'nodes' in config: - if isinstance(config['nodes'], basestring) and config['nodes'] == 'all': + if isinstance(config['nodes'], str) and config['nodes'] == 'all': for role in teuthology.all_roles(ctx.cluster): (remote,) = ctx.cluster.only(role).remotes.keys() ip,port = remote.ssh.get_transport().getpeername() diff --git a/teuthology/task/pcp.py b/teuthology/task/pcp.py index 60aceab8ae..c4a6b61a40 100644 --- a/teuthology/task/pcp.py +++ b/teuthology/task/pcp.py @@ -13,9 +13,6 @@ from teuthology.config import config as teuth_config from teuthology.orchestra import run from teuthology import misc - -from six import string_types as basestring - from teuthology.task import Task log = logging.getLogger(__name__) @@ -56,7 +53,7 @@ class PCPArchive(PCPDataSource): @staticmethod def _format_time(seconds): - if isinstance(seconds, basestring): + if isinstance(seconds, str): return seconds return "@ %s" % time.asctime(time.gmtime(seconds)) @@ -91,7 +88,7 @@ class GrafanaGrapher(PCPGrapher): @staticmethod def _format_time(seconds): - if isinstance(seconds, basestring): + if isinstance(seconds, str): return seconds seconds = int(seconds) dt = datetime.datetime.fromtimestamp(seconds, dateutil.tz.tzutc()) -- 2.39.5