from tempfile import mkstemp
from xml.dom.minidom import Document, parseString
-from sfa.util.py23 import PY3, StringType, StringIO
+from io import StringIO
from xml.parsers.expat import ExpatError
self.version = None
if cred:
- if isinstance(cred, StringType):
+ if isinstance(cred, str):
string = cred
self.type = Credential.SFA_CREDENTIAL_TYPE
self.version = '3'
str = infile.read()
# if this is a legacy credential, write error and bail out
- if isinstance(str, StringType) and str.strip().startswith("-----"):
+ if isinstance(str, str) and str.strip().startswith("-----"):
logger.error(
"Legacy credentials not supported any more "
"- giving up with {}..."
f = filep
else:
f = open(filename, "w")
- if PY3 and isinstance(self.xml, bytes):
+ if isinstance(self.xml, bytes):
self.xml = self.xml.decode()
f.write(self.xml)
f.close()
def save_to_string(self, save_parents=True):
if not self.xml:
self.encode()
- if PY3 and isinstance(self.xml, bytes):
+ if isinstance(self.xml, bytes):
self.xml = self.xml.decode()
return self.xml