feat: adicionando mensagem de erro e aviso
mensagem de erro ao encontrar um evento sem header numero 7 mensagem de aviso ao encontrar um header não implementado
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from datetime import datetime, time
|
from datetime import datetime, time
|
||||||
|
import warnings
|
||||||
|
|
||||||
def is_blank(l: str) -> bool:
|
def is_blank(l: str) -> bool:
|
||||||
return len(l.strip(" ")) == 0
|
return len(l.strip(" ")) == 0
|
||||||
@@ -50,6 +51,9 @@ def parse_chunk(chunk_lines: list[str]):
|
|||||||
if l[-1] == "7":
|
if l[-1] == "7":
|
||||||
hIdx = idx
|
hIdx = idx
|
||||||
break
|
break
|
||||||
|
if hIdx is None:
|
||||||
|
raise ValueError("Expected a '7' phase header in chunk_lines")
|
||||||
|
else:
|
||||||
headersRet = parse_header(chunk_lines[:hIdx])
|
headersRet = parse_header(chunk_lines[:hIdx])
|
||||||
# TODO: implementar o parser das fases parser_type_7
|
# TODO: implementar o parser das fases parser_type_7
|
||||||
|
|
||||||
@@ -73,8 +77,8 @@ def parse_header(hLines: list[str]):
|
|||||||
aux["I"].append(line)
|
aux["I"].append(line)
|
||||||
case "F":
|
case "F":
|
||||||
aux["F"].append(line)
|
aux["F"].append(line)
|
||||||
case _:
|
case unknown:
|
||||||
raise NotImplemented
|
warnings.warn(f"header type not implemented: {unknown}")
|
||||||
|
|
||||||
headerDict = dict()
|
headerDict = dict()
|
||||||
for (k,v) in aux.items():
|
for (k,v) in aux.items():
|
||||||
|
|||||||
Reference in New Issue
Block a user