From 6ae554162c721bc06d00e3da2a82d141e7397e97 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Thu, 3 May 2018 15:48:48 -0500 Subject: [PATCH] Remove use of six nodepool is python3 only now, so there is no need to continue to use the six library. Remove its use and shift to just using python3 versions of things. Change-Id: Ic1d1b4b736deba1b8325adf0b446e2121eaa6b20 --- nodepool/driver/__init__.py | 11 +++-------- nodepool/task_manager.py | 7 +++---- nodepool/tests/test_webapp.py | 2 +- nodepool/zk.py | 3 +-- requirements.txt | 2 -- 5 files changed, 8 insertions(+), 17 deletions(-) diff --git a/nodepool/driver/__init__.py b/nodepool/driver/__init__.py index d47ff78ed..1f20e8484 100644 --- a/nodepool/driver/__init__.py +++ b/nodepool/driver/__init__.py @@ -25,8 +25,6 @@ import os import time import threading -import six - from kazoo import exceptions as kze from nodepool import zk @@ -107,8 +105,7 @@ class Drivers: raise RuntimeError("%s: unknown driver" % name) -@six.add_metaclass(abc.ABCMeta) -class Provider(object): +class Provider(object, metaclass=abc.ABCMeta): """The Provider interface The class or instance attribute **name** must be provided as a string. @@ -147,8 +144,7 @@ class Provider(object): pass -@six.add_metaclass(abc.ABCMeta) -class NodeRequestHandler(object): +class NodeRequestHandler(object, metaclass=abc.ABCMeta): ''' Class to process a single nodeset request. @@ -707,8 +703,7 @@ class Driver(ConfigValue): pass -@six.add_metaclass(abc.ABCMeta) -class ProviderConfig(ConfigValue): +class ProviderConfig(ConfigValue, metaclass=abc.ABCMeta): """The Provider config interface The class or instance attribute **name** must be provided as a string. diff --git a/nodepool/task_manager.py b/nodepool/task_manager.py index 95c493bea..0453d167f 100644 --- a/nodepool/task_manager.py +++ b/nodepool/task_manager.py @@ -18,9 +18,8 @@ import sys import threading -import six -from six.moves import queue as Queue import logging +import queue import time import requests.exceptions @@ -51,7 +50,7 @@ class Task(object): def wait(self): self._wait_event.wait() if self._exception: - six.reraise(self._exception, None, self._traceback) + raise self._exception.with_traceback(self._traceback) return self._result def run(self, client): @@ -69,7 +68,7 @@ class TaskManager(threading.Thread): def __init__(self, client, name, rate): super(TaskManager, self).__init__(name=name) self.daemon = True - self.queue = Queue.Queue() + self.queue = queue.Queue() self._running = True self.name = name self.rate = float(rate) diff --git a/nodepool/tests/test_webapp.py b/nodepool/tests/test_webapp.py index dcd2ab6d0..d45c9cf8a 100644 --- a/nodepool/tests/test_webapp.py +++ b/nodepool/tests/test_webapp.py @@ -16,7 +16,7 @@ import json import logging import yaml -from six.moves.urllib import request +from urllib import request from nodepool import tests from nodepool import zk diff --git a/nodepool/zk.py b/nodepool/zk.py index beb90e7f2..19e6078ba 100755 --- a/nodepool/zk.py +++ b/nodepool/zk.py @@ -17,7 +17,6 @@ from copy import copy import abc import json import logging -import six import time from kazoo.client import KazooClient, KazooState from kazoo import exceptions as kze @@ -204,7 +203,7 @@ class BaseModel(Serializable): @id.setter def id(self, value): - if not isinstance(value, six.string_types): + if not isinstance(value, str): raise TypeError("'id' attribute must be a string type") self._id = value diff --git a/requirements.txt b/requirements.txt index 74799ccfc..156589828 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,8 +7,6 @@ extras statsd>=3.0 sqlalchemy>=0.8.2,<1.1.0 PrettyTable>=0.6,<0.8 -# shade has a looser requirement on six than nodepool, so install six first -six>=1.7.0 os-client-config>=1.2.0 shade>=1.21.0 diskimage-builder>=2.0.0