bug fixes

This commit is contained in:
Steve Nyemba 2019-11-05 16:04:54 -06:00
parent d0a0334f7a
commit ac64f8de95
3 changed files with 8 additions and 8 deletions

View File

@ -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:

View File

@ -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;

View File

@ -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)