diff --git a/pyghmi/cmd/pyghmicons.py b/pyghmi/cmd/pyghmicons.py index 3d1d04be..165d836a 100755 --- a/pyghmi/cmd/pyghmicons.py +++ b/pyghmi/cmd/pyghmicons.py @@ -22,8 +22,6 @@ import termios import threading import tty -import six - from pyghmi.ipmi import console @@ -42,7 +40,7 @@ def _doinput(sol): def _print(data): bailout = False - if not isinstance(data, six.string_types): + if not isinstance(data, str): bailout = True data = repr(data) sys.stdout.write(data) diff --git a/pyghmi/ipmi/oem/lenovo/config.py b/pyghmi/ipmi/oem/lenovo/config.py index 0e897bc7..941c7618 100644 --- a/pyghmi/ipmi/oem/lenovo/config.py +++ b/pyghmi/ipmi/oem/lenovo/config.py @@ -22,7 +22,6 @@ import base64 import random import struct -import six import time import pyghmi.exceptions as pygexc @@ -564,7 +563,7 @@ class LenovoFirmwareConfig(object): continue if options[option]['pending'] == options[option]['new_value']: continue - if isinstance(options[option]['new_value'], six.string_types): + if isinstance(options[option]['new_value'], str): # Coerce a simple string parameter to the expected list format options[option]['new_value'] = [options[option]['new_value']] options[option]['pending'] = options[option]['new_value'] diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index 598bebfd..eaef11a6 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -27,7 +27,6 @@ import socket import struct import weakref -import six import zipfile import pyghmi.constants as pygconst @@ -281,7 +280,7 @@ class IMMClient(object): def merge_changeset(self, changeset): for key in changeset: - if isinstance(changeset[key], six.string_types): + if isinstance(changeset[key], str): changeset[key] = {'value': changeset[key]} newvalue = changeset[key]['value'] if self.fwo[key]['is_list'] and not isinstance(newvalue, list): @@ -1124,7 +1123,7 @@ class XCCClient(IMMClient): ruleset = {} usbsettings = {} for key in changeset: - if isinstance(changeset[key], six.string_types): + if isinstance(changeset[key], str): changeset[key] = {'value': changeset[key]} currval = changeset[key].get('value', None) if 'smm'.startswith(key.lower()): diff --git a/pyghmi/ipmi/oem/lenovo/nextscale.py b/pyghmi/ipmi/oem/lenovo/nextscale.py index 2d963e9a..6acebb7c 100644 --- a/pyghmi/ipmi/oem/lenovo/nextscale.py +++ b/pyghmi/ipmi/oem/lenovo/nextscale.py @@ -18,8 +18,6 @@ import weakref from xml.etree.ElementTree import fromstring as rfromstring import zipfile -import six - import pyghmi.constants as pygconst import pyghmi.exceptions as pygexc import pyghmi.ipmi.private.session as ipmisession @@ -641,7 +639,7 @@ class SMMClient(object): for key in changeset: if not key: raise pygexc.InvalidParameterValue('Empty key is invalid') - if isinstance(changeset[key], six.string_types): + if isinstance(changeset[key], str): changeset[key] = {'value': changeset[key]} for rule in self.rulemap: if fnmatch.fnmatch(rule, key.lower()): diff --git a/pyghmi/ipmi/sdr.py b/pyghmi/ipmi/sdr.py index 83989345..4b9831e2 100644 --- a/pyghmi/ipmi/sdr.py +++ b/pyghmi/ipmi/sdr.py @@ -36,8 +36,6 @@ import string import struct import weakref -import six - import pyghmi.constants as const import pyghmi.exceptions as exc @@ -621,8 +619,7 @@ class SDREntry(object): return "" if ipmitype == 0: # Unicode per 43.15 in ipmi 2.0 spec # the spec is not specific about encoding, assuming utf8 - return six.text_type(struct.pack("%dB" % len(data), *data), - "utf_8") + return struct.pack("%dB" % len(data), *data).decode("utf-8") elif ipmitype == 1: # BCD '+' tmpl = "%02X" * len(data) tstr = tmpl % tuple(data) diff --git a/pyghmi/redfish/oem/lenovo/tsma.py b/pyghmi/redfish/oem/lenovo/tsma.py index 18e54c70..f4303268 100644 --- a/pyghmi/redfish/oem/lenovo/tsma.py +++ b/pyghmi/redfish/oem/lenovo/tsma.py @@ -20,8 +20,6 @@ try: except ImportError: from urllib.parse import urlencode -import six - import pyghmi.exceptions as exc import pyghmi.media as media import pyghmi.redfish.oem.generic as generic @@ -171,7 +169,7 @@ class TsmHandler(generic.OEMHandler): dnschgs = {} wc = self.wc for key in changeset: - if isinstance(changeset[key], six.string_types): + if isinstance(changeset[key], str): changeset[key] = {'value': changeset[key]} currval = changeset[key].get('value', None) if 'dns_servers'.startswith(key.lower()): diff --git a/pyghmi/redfish/oem/lenovo/xcc.py b/pyghmi/redfish/oem/lenovo/xcc.py index f7d834c7..4f3a9fa8 100644 --- a/pyghmi/redfish/oem/lenovo/xcc.py +++ b/pyghmi/redfish/oem/lenovo/xcc.py @@ -23,7 +23,6 @@ import re import socket import time -import six import zipfile import pyghmi.constants as pygconst @@ -261,7 +260,7 @@ class OEMHandler(generic.OEMHandler): def merge_changeset(self, changeset): for key in changeset: - if isinstance(changeset[key], six.string_types): + if isinstance(changeset[key], str): changeset[key] = {'value': changeset[key]} newvalue = changeset[key]['value'] if self.fwo[key]['is_list'] and not isinstance(newvalue, list): @@ -416,7 +415,7 @@ class OEMHandler(generic.OEMHandler): usbsettings = {} secparms = {} for key in changeset: - if isinstance(changeset[key], six.string_types): + if isinstance(changeset[key], str): changeset[key] = {'value': changeset[key]} currval = changeset[key].get('value', None) if key.lower() in self.rulemap: diff --git a/pyghmi/util/webclient.py b/pyghmi/util/webclient.py index 48d15bed..d863b265 100644 --- a/pyghmi/util/webclient.py +++ b/pyghmi/util/webclient.py @@ -26,8 +26,6 @@ import ssl import threading import os -import six - import pyghmi.exceptions as pygexc try: @@ -306,7 +304,7 @@ class SecureHTTPConnection(httplib.HTTPConnection, object): """Download a file to filename or file object """ - if isinstance(file, six.string_types): + if isinstance(file, str): file = open(file, 'wb') webclient = self.dupe() dlheaders = self.stdheaders.copy() diff --git a/requirements.txt b/requirements.txt index e527df17..59e27054 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ cryptography>=2.1 # BSD/Apache-2.0 python-dateutil>=2.8.1 # BSD -six>=1.10.0 # MIT