浏览代码

bug fixes

Steve Nyemba 6 年之前
父节点
当前提交
ac64f8de95
共有 3 个文件被更改,包括 8 次插入8 次删除
  1. 1 1
      transport/__init__.py
  2. 6 6
      transport/common.py
  3. 1 1
      transport/queue.py

+ 1 - 1
transport/__init__.py

@@ -91,7 +91,7 @@ class factory :
 			anObject = eval( aClassName)
 			#setattr(anObject,'name',source)
 		except Exception as e:
-			print ['Error ',e]
+			print(['Error ',e])
 		return anObject
 
 # class Reader:

+ 6 - 6
transport/common.py

@@ -39,7 +39,7 @@ class Reader:
 		"""
 		
 		m = {',':[],'\t':[],'|':[],'\x3A':[]} 
-		delim = m.keys()
+		delim = list(m.keys())
 		for row in sample:
 			for xchar in delim:
 				if row.split(xchar) > 1:	
@@ -53,9 +53,9 @@ class Reader:
 		# The delimiter with the smallest variance, provided the mean is greater than 1
 		# This would be troublesome if there many broken records sampled
 		#
-		m = {id: np.var(m[id]) for id in m.keys() if m[id] != [] and int(np.mean(m[id]))>1}
-		index = m.values().index( min(m.values()))
-		xchar = m.keys()[index]
+		m = {id: np.var(m[id]) for id in list(m.keys()) if m[id] != [] and int(np.mean(m[id]))>1}
+		index = list(m.values()).index( min(m.values()))
+		xchar = list(m.keys())[index]
 		
 		return xchar
 	def col_count(self,sample):
@@ -76,8 +76,8 @@ class Reader:
 				m[id] = 0
 			m[id] = m[id] + 1
 		
-		index = m.values().index( max(m.values()) )
-		ncols = int(m.keys()[index])
+		index = list(m.values()).index( max(m.values()) )
+		ncols = int(list(m.keys())[index])
 		
 		
 		return ncols;

+ 1 - 1
transport/queue.py

@@ -175,7 +175,7 @@ class QueueReader(MessageQueue,Reader):
 		# We enabled the reader to be able to read from several queues (sequentially for now)
 		# The qid parameter will be an array of queues the reader will be reading from
 		#
-		if isinstance(self.qid,basestring) :
+		if isinstance(self.qid,str) :
 					self.qid = [self.qid]
 		for qid in self.qid:
 			self.init(qid)