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
This commit is contained in:
Monty Taylor 2018-05-03 15:48:48 -05:00 committed by Ian Wienand
parent 98850e16a3
commit 6ae554162c
5 changed files with 8 additions and 17 deletions

View File

@ -25,8 +25,6 @@ import os
import time import time
import threading import threading
import six
from kazoo import exceptions as kze from kazoo import exceptions as kze
from nodepool import zk from nodepool import zk
@ -107,8 +105,7 @@ class Drivers:
raise RuntimeError("%s: unknown driver" % name) raise RuntimeError("%s: unknown driver" % name)
@six.add_metaclass(abc.ABCMeta) class Provider(object, metaclass=abc.ABCMeta):
class Provider(object):
"""The Provider interface """The Provider interface
The class or instance attribute **name** must be provided as a string. The class or instance attribute **name** must be provided as a string.
@ -147,8 +144,7 @@ class Provider(object):
pass pass
@six.add_metaclass(abc.ABCMeta) class NodeRequestHandler(object, metaclass=abc.ABCMeta):
class NodeRequestHandler(object):
''' '''
Class to process a single nodeset request. Class to process a single nodeset request.
@ -707,8 +703,7 @@ class Driver(ConfigValue):
pass pass
@six.add_metaclass(abc.ABCMeta) class ProviderConfig(ConfigValue, metaclass=abc.ABCMeta):
class ProviderConfig(ConfigValue):
"""The Provider config interface """The Provider config interface
The class or instance attribute **name** must be provided as a string. The class or instance attribute **name** must be provided as a string.

View File

@ -18,9 +18,8 @@
import sys import sys
import threading import threading
import six
from six.moves import queue as Queue
import logging import logging
import queue
import time import time
import requests.exceptions import requests.exceptions
@ -51,7 +50,7 @@ class Task(object):
def wait(self): def wait(self):
self._wait_event.wait() self._wait_event.wait()
if self._exception: if self._exception:
six.reraise(self._exception, None, self._traceback) raise self._exception.with_traceback(self._traceback)
return self._result return self._result
def run(self, client): def run(self, client):
@ -69,7 +68,7 @@ class TaskManager(threading.Thread):
def __init__(self, client, name, rate): def __init__(self, client, name, rate):
super(TaskManager, self).__init__(name=name) super(TaskManager, self).__init__(name=name)
self.daemon = True self.daemon = True
self.queue = Queue.Queue() self.queue = queue.Queue()
self._running = True self._running = True
self.name = name self.name = name
self.rate = float(rate) self.rate = float(rate)

View File

@ -16,7 +16,7 @@
import json import json
import logging import logging
import yaml import yaml
from six.moves.urllib import request from urllib import request
from nodepool import tests from nodepool import tests
from nodepool import zk from nodepool import zk

View File

@ -17,7 +17,6 @@ from copy import copy
import abc import abc
import json import json
import logging import logging
import six
import time import time
from kazoo.client import KazooClient, KazooState from kazoo.client import KazooClient, KazooState
from kazoo import exceptions as kze from kazoo import exceptions as kze
@ -204,7 +203,7 @@ class BaseModel(Serializable):
@id.setter @id.setter
def id(self, value): 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") raise TypeError("'id' attribute must be a string type")
self._id = value self._id = value

View File

@ -7,8 +7,6 @@ extras
statsd>=3.0 statsd>=3.0
sqlalchemy>=0.8.2,<1.1.0 sqlalchemy>=0.8.2,<1.1.0
PrettyTable>=0.6,<0.8 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 os-client-config>=1.2.0
shade>=1.21.0 shade>=1.21.0
diskimage-builder>=2.0.0 diskimage-builder>=2.0.0