Remove six dependency
Change-Id: I0b1578a7c0083d78f864fb21bcd33ac2955a52d5
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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']
|
||||
|
||||
@@ -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()):
|
||||
|
||||
@@ -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()):
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()):
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
cryptography>=2.1 # BSD/Apache-2.0
|
||||
python-dateutil>=2.8.1 # BSD
|
||||
six>=1.10.0 # MIT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user