From e4ba33aa4b8f272281d7875d001c8e9584c14857 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 9 Jan 2025 23:15:59 +0900 Subject: [PATCH] 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 --- cyborg/accelerator/drivers/pci/devspec.py | 6 ++---- cyborg/accelerator/drivers/pci/utils.py | 5 ++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cyborg/accelerator/drivers/pci/devspec.py b/cyborg/accelerator/drivers/pci/devspec.py index 0e61ac07..91ad68a7 100644 --- a/cyborg/accelerator/drivers/pci/devspec.py +++ b/cyborg/accelerator/drivers/pci/devspec.py @@ -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) diff --git a/cyborg/accelerator/drivers/pci/utils.py b/cyborg/accelerator/drivers/pci/utils.py index 5ead8e5f..26e365dd 100644 --- a/cyborg/accelerator/drivers/pci/utils.py +++ b/cyborg/accelerator/drivers/pci/utils.py @@ -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