bug fixes
This commit is contained in:
parent
d0a0334f7a
commit
ac64f8de95
|
@ -91,7 +91,7 @@ class factory :
|
||||||
anObject = eval( aClassName)
|
anObject = eval( aClassName)
|
||||||
#setattr(anObject,'name',source)
|
#setattr(anObject,'name',source)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print ['Error ',e]
|
print(['Error ',e])
|
||||||
return anObject
|
return anObject
|
||||||
|
|
||||||
# class Reader:
|
# class Reader:
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Reader:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
m = {',':[],'\t':[],'|':[],'\x3A':[]}
|
m = {',':[],'\t':[],'|':[],'\x3A':[]}
|
||||||
delim = m.keys()
|
delim = list(m.keys())
|
||||||
for row in sample:
|
for row in sample:
|
||||||
for xchar in delim:
|
for xchar in delim:
|
||||||
if row.split(xchar) > 1:
|
if row.split(xchar) > 1:
|
||||||
|
@ -53,9 +53,9 @@ class Reader:
|
||||||
# The delimiter with the smallest variance, provided the mean is greater than 1
|
# The delimiter with the smallest variance, provided the mean is greater than 1
|
||||||
# This would be troublesome if there many broken records sampled
|
# 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}
|
m = {id: np.var(m[id]) for id in list(m.keys()) if m[id] != [] and int(np.mean(m[id]))>1}
|
||||||
index = m.values().index( min(m.values()))
|
index = list(m.values()).index( min(m.values()))
|
||||||
xchar = m.keys()[index]
|
xchar = list(m.keys())[index]
|
||||||
|
|
||||||
return xchar
|
return xchar
|
||||||
def col_count(self,sample):
|
def col_count(self,sample):
|
||||||
|
@ -76,8 +76,8 @@ class Reader:
|
||||||
m[id] = 0
|
m[id] = 0
|
||||||
m[id] = m[id] + 1
|
m[id] = m[id] + 1
|
||||||
|
|
||||||
index = m.values().index( max(m.values()) )
|
index = list(m.values()).index( max(m.values()) )
|
||||||
ncols = int(m.keys()[index])
|
ncols = int(list(m.keys())[index])
|
||||||
|
|
||||||
|
|
||||||
return ncols;
|
return ncols;
|
||||||
|
|
|
@ -175,7 +175,7 @@ class QueueReader(MessageQueue,Reader):
|
||||||
# We enabled the reader to be able to read from several queues (sequentially for now)
|
# 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
|
# 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]
|
self.qid = [self.qid]
|
||||||
for qid in self.qid:
|
for qid in self.qid:
|
||||||
self.init(qid)
|
self.init(qid)
|
||||||
|
|
Loading…
Reference in New Issue