bug fix: section/loop definition

docker
Steve L. Nyemba 4 years ago
parent 6f726bfac8
commit cb150f1d90

@ -287,7 +287,7 @@ def get_content(filename,config,section=None) :
# tmp = get_map(row,_info,VERSION) # tmp = get_map(row,_info,VERSION)
# if 'parser' in _info : # if 'parser' in _info :
# pointer = eval(_info['parser']) # pointer = eval(_info['parser'])
# print (pointer(row))
tmp = get_map(row,_info,VERSION) tmp = get_map(row,_info,VERSION)
except Exception as e: except Exception as e:
@ -323,7 +323,7 @@ def get_content(filename,config,section=None) :
if label not in claim: if label not in claim:
claim[label] = [tmp] claim[label] = [tmp]
elif len(list(tmp.keys())) == 1 : elif len(list(tmp.keys())) == 1 :
# print "\t",len(claim[label]),tmp
index = len(claim[label]) -1 index = len(claim[label]) -1
claim[label][index] = dict(claim[label][index],**tmp) claim[label][index] = dict(claim[label][index],**tmp)
else: else:

@ -277,7 +277,7 @@ class Parser (Process):
value = {} value = {}
for row in content[:] : for row in content[:] :
row = util.split(row) row = util.split(row.replace('\n','').replace('~',''))
_info = util.get.config(self.config[_code][0],row) _info = util.get.config(self.config[_code][0],row)
if _info : if _info :
@ -327,7 +327,8 @@ class Parser (Process):
pass pass
except Exception as e : except Exception as e :
print ('__',e)
print ('__',e.args)
pass pass
return value if value else {} return value if value else {}
@ -373,8 +374,8 @@ class Parser (Process):
INITIAL_ROWS = file[:4] INITIAL_ROWS = file[:4]
if len(INITIAL_ROWS) < 3 : if len(INITIAL_ROWS) < 3 :
return None,[{"name":filename,"completed":False}],None return None,[{"name":filename,"completed":False}],None
section = 'CLM' if INITIAL_ROWS[1].split('*')[1] == 'HC' else 'CLP' section = 'HL' if INITIAL_ROWS[1].split('*')[1] == 'HC' else 'CLP'
_code = '837' if section == 'CLM' else '835' _code = '837' if section == 'HL' else '835'
DEFAULT_VALUE = self.get.default_value(INITIAL_ROWS,_code) DEFAULT_VALUE = self.get.default_value(INITIAL_ROWS,_code)
DEFAULT_VALUE['name'] = filename.strip() DEFAULT_VALUE['name'] = filename.strip()
# #
@ -396,13 +397,13 @@ class Parser (Process):
# #
# process the segment somewhere (create a thread maybe?) # process the segment somewhere (create a thread maybe?)
# #
default_claim = dict({"index":index},**DEFAULT_VALUE) # default_claim = dict({"index":index},**DEFAULT_VALUE)
_claim = self.apply(segment,_code) _claim = self.apply(segment,_code)
# if _claim['claim_id'] == 'P1080351470' : # if _claim['claim_id'] == 'P1080351470' :
# print (_claim) # print (_claim)
# _claim = dict(DEFAULT_VALUE,**_claim) # _claim = dict(DEFAULT_VALUE,**_claim)
if _claim : if _claim :
_claim['index'] = len(claims) _claim['index'] = index #len(claims)
claims.append(dict(DEFAULT_VALUE,**_claim)) claims.append(dict(DEFAULT_VALUE,**_claim))
segment = [row] segment = [row]
index += 1 index += 1

Loading…
Cancel
Save