10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-11-04 05:03:53 +01:00

getSubtableIndex is now a local function

This commit is contained in:
Mickaël Véril 2020-02-16 15:22:21 +01:00
parent aeae909a36
commit 7b2654811b

View File

@ -65,6 +65,16 @@ class dataFileBase(object):
@staticmethod @staticmethod
def readFromTable(table,format=Format.LINE,default=dataType.ABS ,firstState=state(1,1,"A_1"),commands=[]): def readFromTable(table,format=Format.LINE,default=dataType.ABS ,firstState=state(1,1,"A_1"),commands=[]):
def getSubtableIndex(table):
subtablesindex=list()
firstindex=2
for i in range(3,np.size(table,0)):
if str(table[i,0])!="":
subtablesindex.append((firstindex,i-1))
firstindex=i
subtablesindex.append((firstindex,np.size(table,0)))
return subtablesindex
datalist=list() datalist=list()
switcher={ switcher={
dataType.ABS:AbsDataFile, dataType.ABS:AbsDataFile,
@ -96,13 +106,7 @@ class dataFileBase(object):
datalist.append(value) datalist.append(value)
return datalist return datalist
elif format==Format.COLUMN: elif format==Format.COLUMN:
subtablesindex=list() subtablesindex=getSubtableIndex(table)
firstindex=2
for i in range(3,np.size(table,0)):
if str(table[i,0])!="":
subtablesindex.append((firstindex,i-1))
firstindex=i
subtablesindex.append((firstindex,np.size(table,0)))
for first, last in subtablesindex: for first, last in subtablesindex:
for col in range(2,np.size(table,1)): for col in range(2,np.size(table,1)):
datacls=dict() datacls=dict()
@ -128,13 +132,7 @@ class dataFileBase(object):
datalist.append(value) datalist.append(value)
return datalist return datalist
elif format==Format.TBE: elif format==Format.TBE:
subtablesindex=list() subtablesindex=getSubtableIndex(table)
firstindex=2
for i in range(3,np.size(table,0)):
if str(table[i,0])!="":
subtablesindex.append((firstindex,i-1))
firstindex=i
subtablesindex.append((firstindex,np.size(table,0)))
for first, last in subtablesindex: for first, last in subtablesindex:
datacls=dict() datacls=dict()
mymolecule=str(table[first,0]) mymolecule=str(table[first,0])