Remove six
Python 2 reached its EOL long time ago so we no longer need to use six to guarantee compatibility with Python 2. Also set the minimum python version to avoid installation in old Python 3 versions which already reached EOL. Change-Id: I8f3fb493fd09943660fdae24bf592fbc3ff7ea2b
This commit is contained in:
parent
3ee69d2d37
commit
c3ca521025
@ -1,6 +1,3 @@
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
||||
Babel!=2.4.0,>=2.3.4 # BSD
|
||||
pyghmi>=1.0.24 # Apache-2.0
|
||||
@ -9,6 +6,5 @@ pyasn1>=0.5.1 # BSD
|
||||
pyasn1-modules>=0.3.0 # BSD
|
||||
requests>=2.14.2 # Apache-2.0
|
||||
defusedxml>=0.7.0 # PSF
|
||||
six>=1.10.0 # MIT
|
||||
oslo.utils>=3.33.0 # Apache-2.0
|
||||
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
|
||||
|
@ -21,7 +21,6 @@ import time
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
import requests
|
||||
import six
|
||||
|
||||
from scciclient.irmc import scci
|
||||
|
||||
@ -1118,7 +1117,7 @@ def set_bios_configuration(irmc_info, settings):
|
||||
setting_value = setting_param.get("value")
|
||||
# Revert-conversion from a string of True/False to boolean.
|
||||
# It will be raise failed if put "True" or "False" string value.
|
||||
if isinstance(setting_value, six.string_types):
|
||||
if isinstance(setting_value, str):
|
||||
if setting_value.lower() == "true":
|
||||
setting_value = True
|
||||
elif setting_value.lower() == "false":
|
||||
@ -1153,6 +1152,6 @@ def get_bios_settings(irmc_info):
|
||||
type_config, config = BIOS_CONFIGURATION_DICTIONARY[
|
||||
setting_param].split("_")
|
||||
if config in bios_config_data.get(type_config, {}):
|
||||
value = six.text_type(bios_config_data[type_config][config])
|
||||
value = str(bios_config_data[type_config][config])
|
||||
settings.append({'name': setting_param, 'value': value})
|
||||
return settings
|
||||
|
@ -22,7 +22,6 @@ import time
|
||||
|
||||
import defusedxml.ElementTree as ET
|
||||
import requests
|
||||
import six
|
||||
|
||||
from scciclient.irmc import ipmi
|
||||
from scciclient.irmc import snmp
|
||||
@ -250,8 +249,7 @@ class MetaShareType(type):
|
||||
return cls.CIFS
|
||||
|
||||
|
||||
@six.add_metaclass(MetaShareType)
|
||||
class ShareType(object):
|
||||
class ShareType(object, metaclass=MetaShareType):
|
||||
""""Virtual Media Share Type."""
|
||||
NFS = 0
|
||||
CIFS = 1
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
from pysnmp import error as snmp_error
|
||||
from pysnmp import hlapi as snmp
|
||||
import six
|
||||
|
||||
|
||||
BMC_NAME_OID = '1.3.6.1.4.1.231.2.10.2.2.10.3.4.1.3.1.1'
|
||||
@ -96,7 +95,7 @@ def get_bios_firmware_version(snmp_client):
|
||||
|
||||
try:
|
||||
bios_firmware_version = snmp_client.get(BIOS_FW_VERSION_OID)
|
||||
return six.text_type(bios_firmware_version)
|
||||
return str(bios_firmware_version)
|
||||
except SNMPFailure as e:
|
||||
raise SNMPBIOSFirmwareFailure(
|
||||
SNMP_FAILURE_MSG % ("GET BIOS FIRMWARE VERSION", e))
|
||||
@ -112,7 +111,7 @@ def get_server_model(snmp_client):
|
||||
|
||||
try:
|
||||
server_model = snmp_client.get(SERVER_MODEL_OID)
|
||||
return six.text_type(server_model)
|
||||
return str(server_model)
|
||||
except SNMPFailure as e:
|
||||
raise SNMPServerModelFailure(
|
||||
SNMP_FAILURE_MSG % ("GET SERVER MODEL", e))
|
||||
|
@ -17,8 +17,6 @@ import re
|
||||
import socket
|
||||
import struct
|
||||
|
||||
import six
|
||||
|
||||
from scciclient.irmc import scci
|
||||
from scciclient.irmc.viom import elcm
|
||||
|
||||
@ -44,8 +42,7 @@ _CNA_FCOE_FUNC_IDX = 2
|
||||
_CNA_ISCSI_FUNC_IDX = 3
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class _PortHandler(object):
|
||||
class _PortHandler(object, metaclass=abc.ABCMeta):
|
||||
"""VIOM Configurator with physical port information"""
|
||||
|
||||
def __init__(self, slot_type, card_type, slot_idx, card_idx, port_idx):
|
||||
|
@ -16,8 +16,6 @@ import abc
|
||||
import json
|
||||
import time
|
||||
|
||||
import six
|
||||
|
||||
from scciclient.irmc import elcm
|
||||
from scciclient.irmc import scci
|
||||
|
||||
@ -121,8 +119,7 @@ class VIOMAttribute(object):
|
||||
self.init = init
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class VIOMElement(object):
|
||||
class VIOMElement(object, metaclass=abc.ABCMeta):
|
||||
"""Element in VIOM table."""
|
||||
def __init__(self, **kwargs):
|
||||
for attr in self.__class__._BASIC_ATTRIBUTES:
|
||||
@ -287,8 +284,7 @@ class Slot(VIOMElement):
|
||||
return json
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class PCICard(object):
|
||||
class PCICard(object, metaclass=abc.ABCMeta):
|
||||
"Abstract class for PCI cards."
|
||||
def __init__(self, card_idx, adapter):
|
||||
self.card_idx = card_idx
|
||||
@ -341,8 +337,7 @@ class AddOnCard(PCICard):
|
||||
INDEX_KEY = '@AddOnCardIdx'
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class Adapter(object):
|
||||
class Adapter(object, metaclass=abc.ABCMeta):
|
||||
"""Abstract class for adapters.
|
||||
|
||||
Adapter represents type of PCI card.
|
||||
@ -395,8 +390,7 @@ class CNAAdapter(Adapter):
|
||||
ADAPTER_NAME = 'CNAAdapter'
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class AdapterPort(VIOMElement):
|
||||
class AdapterPort(VIOMElement, metaclass=abc.ABCMeta):
|
||||
"""Port in adapters."""
|
||||
|
||||
def __init__(self, port_idx, **kwargs):
|
||||
@ -555,8 +549,7 @@ class CNAPort(AdapterPort):
|
||||
return port
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class CNAFunction(VIOMElement):
|
||||
class CNAFunction(VIOMElement, metaclass=abc.ABCMeta):
|
||||
"""Abstract class for Functions for CNA card"""
|
||||
_BASIC_ATTRIBUTES = [
|
||||
VIOMAttribute('function_enable', 'FunctionEnable'),
|
||||
@ -729,8 +722,7 @@ class ISCSIFunction(CNAFunction):
|
||||
return {'MAC': self.mac} if self.mac else None
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class Boot(VIOMElement):
|
||||
class Boot(VIOMElement, metaclass=abc.ABCMeta):
|
||||
"""Abstract class for BootProtocol"""
|
||||
_BASIC_ATTRIBUTES = []
|
||||
|
||||
|
@ -15,6 +15,8 @@
|
||||
Test class for iRMC Power Driver
|
||||
"""
|
||||
|
||||
import builtins
|
||||
import io
|
||||
import os
|
||||
import time
|
||||
from unittest import mock
|
||||
@ -22,18 +24,12 @@ import xml.etree.ElementTree as ET
|
||||
|
||||
import defusedxml.ElementTree as dET
|
||||
from requests_mock.contrib import fixture as rm_fixture
|
||||
import six
|
||||
import six.moves.builtins as __builtin__
|
||||
import testtools
|
||||
|
||||
from scciclient.irmc import ipmi
|
||||
from scciclient.irmc import scci
|
||||
from scciclient.irmc import snmp
|
||||
|
||||
if six.PY3:
|
||||
import io
|
||||
file = io.BytesIO
|
||||
|
||||
|
||||
IRMC_CONFIG_PARTIAL = """<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CMDSEQ>
|
||||
@ -1188,7 +1184,7 @@ class SCCITestCase(testtools.TestCase):
|
||||
upgrade_type)
|
||||
self.assertEqual(expected_status, result['upgrade_status'])
|
||||
|
||||
@mock.patch.object(__builtin__, 'open', autospec=True)
|
||||
@mock.patch.object(builtins, 'open', autospec=True)
|
||||
def test_create_bios_firmware_upgrade(self, open_mock):
|
||||
upgrade_type = 'bios'
|
||||
self.requests_mock.post("http://" + self.irmc_address + "/biosupdate",
|
||||
@ -1210,7 +1206,7 @@ class SCCITestCase(testtools.TestCase):
|
||||
r = client(bios_input)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
|
||||
@mock.patch.object(__builtin__, 'open', side_effect=IOError, autospec=True)
|
||||
@mock.patch.object(builtins, 'open', side_effect=IOError, autospec=True)
|
||||
def test_create_fail_bios_firmware_upgrade(self, open_mock):
|
||||
upgrade_type = 'bios'
|
||||
self.requests_mock.post("http://" + self.irmc_address + "/biosupdate",
|
||||
@ -1234,7 +1230,7 @@ class SCCITestCase(testtools.TestCase):
|
||||
|
||||
self.assertRaises(scci.SCCIClientError, client, bios_input)
|
||||
|
||||
@mock.patch.object(__builtin__, 'open', autospec=True)
|
||||
@mock.patch.object(builtins, 'open', autospec=True)
|
||||
def test_create_irmc_firmware_upgrade(self, open_mock):
|
||||
upgrade_type = 'irmc'
|
||||
self.requests_mock.post("http://" + self.irmc_address +
|
||||
@ -1257,7 +1253,7 @@ class SCCITestCase(testtools.TestCase):
|
||||
r = client(irmc_input)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
|
||||
@mock.patch.object(__builtin__, 'open', side_effect=IOError, autospec=True)
|
||||
@mock.patch.object(builtins, 'open', side_effect=IOError, autospec=True)
|
||||
def test_create_fail_irmc_firmware_upgrade(self, open_mock):
|
||||
upgrade_type = 'irmc'
|
||||
self.requests_mock.post("http://" + self.irmc_address +
|
||||
@ -1271,7 +1267,7 @@ class SCCITestCase(testtools.TestCase):
|
||||
""")
|
||||
# Fake wrong file directory
|
||||
irmc_input = '/media/DATA/TX2540M1111.bin'
|
||||
mock_file_handle = mock.MagicMock(spec=file)
|
||||
mock_file_handle = mock.MagicMock(spec=io.BytesIO)
|
||||
open_mock.return_value = mock_file_handle
|
||||
client = scci.get_client(self.irmc_address,
|
||||
self.irmc_username,
|
||||
|
@ -6,6 +6,7 @@ description_file =
|
||||
author = FUJITSU LIMITED
|
||||
author_email = fj-lsoft-scciclient@dl.jp.fujitsu.com
|
||||
home_page = https://opendev.org/x/python-scciclient
|
||||
python_requires = >=3.8
|
||||
classifier =
|
||||
Development Status :: 4 - Beta
|
||||
Environment :: Console
|
||||
|
@ -1,7 +1,3 @@
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
coverage!=4.4,>=4.0 # Apache-2.0
|
||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||
python-subunit>=1.0.0 # Apache-2.0/BSD
|
||||
|
Loading…
x
Reference in New Issue
Block a user