Remove six

Python 2 support was removed long time ago so we no longer need to use
six to maintain compatibility with Python 2.

Note that six is not listed in requirements now, and this effectively
removes the "hidden" dependency.

Change-Id: I5c2a599679d63b32c4a0ca1754b28f10a2f62dcc
This commit is contained in:
Takashi Kajinami 2025-01-09 23:15:59 +09:00
parent 66a55c2f83
commit e4ba33aa4b
2 changed files with 4 additions and 7 deletions

View File

@ -15,7 +15,6 @@ import abc
import re
import string
import six
from cyborg.accelerator.drivers.pci import utils
from cyborg.common import exception
@ -31,8 +30,7 @@ ANY = '*'
REGEX_ANY = '.*'
@six.add_metaclass(abc.ABCMeta)
class PciAddressSpec(object):
class PciAddressSpec(object, metaclass=abc.ABCMeta):
"""Abstract class for all PCI address spec styles
This class checks the address fields of the pci.passthrough_whitelist
@ -205,7 +203,7 @@ class WhitelistPciAddress(object):
def _init_address_fields(self, pci_addr):
if not self.is_physical_function:
if isinstance(pci_addr, six.string_types):
if isinstance(pci_addr, str):
self.pci_address_spec = PciAddressGlobSpec(pci_addr)
elif isinstance(pci_addr, dict):
self.pci_address_spec = PciAddressRegexSpec(pci_addr)

View File

@ -18,7 +18,6 @@ import re
from oslo_concurrency import processutils
from oslo_log import log as logging
import six
from cyborg.common import exception
import cyborg.privsep
@ -66,9 +65,9 @@ def pci_device_prop_match(pci_dev, specs):
# mismatch with the tags provided by users for port
# binding profile and the ones configured by operators
# with pci whitelist option.
if isinstance(v, six.string_types):
if isinstance(v, str):
v = v.lower()
if isinstance(pci_dev_v, six.string_types):
if isinstance(pci_dev_v, str):
pci_dev_v = pci_dev_v.lower()
if pci_dev_v != v:
return False