Remove sys.version_info checks for python2 and clean some imports.

This commit is contained in:
Emmanuel Gil Peyrot
2014-08-16 22:37:25 +02:00
committed by Florent Le Coz
parent b92dac72f3
commit 0e95015410
13 changed files with 23 additions and 114 deletions
+2 -6
View File
@@ -10,10 +10,6 @@ from slixmpp.xmlstream import ET
import base64
import logging
import time
import sys
if sys.version_info > (3, 0):
unicode = str
log = logging.getLogger(__name__)
@@ -58,7 +54,7 @@ def _py2xml(*args):
boolean = ET.Element("{%s}boolean" % _namespace)
boolean.text = str(int(x))
val.append(boolean)
elif type(x) in (str, unicode):
elif type(x) is str:
string = ET.Element("{%s}string" % _namespace)
string.text = x
val.append(string)
@@ -156,7 +152,7 @@ class rpctime(object):
def __init__(self,data=None):
#assume string data is in iso format YYYYMMDDTHH:MM:SS
if type(data) in (str, unicode):
if type(data) is str:
self.timestamp = time.strptime(data,"%Y%m%dT%H:%M:%S")
elif type(data) is time.struct_time:
self.timestamp = data