35 lines
810 B
Python
Executable File
35 lines
810 B
Python
Executable File
#!/usr/bin/env python3
|
|
import re
|
|
|
|
from utils.config import set_config as setting
|
|
|
|
unit_type = dict(G801 = 7, G802 = 0)
|
|
#unit_type = ("G801", "G802")
|
|
|
|
reg_list = ['LOC[0-9]{4}', 'DT[0-9]{4}']
|
|
|
|
cfg = setting.config()
|
|
|
|
print(unit_type)
|
|
|
|
file_name = 'G201_LOC1111ID783poppo'
|
|
print(cfg.toolname, cfg.unitname)
|
|
|
|
tool = [match for pattern in reg_list for match in re.findall(pattern, file_name)]
|
|
|
|
print(tool)
|
|
|
|
unit = [match for pattern in cfg.unitname for match in re.findall(pattern, file_name)]
|
|
|
|
print(unit)
|
|
|
|
with open('/home/alex/CSV_ASE/G201_DT0030.csv', 'r') as file:
|
|
lines = file.readlines()
|
|
try:
|
|
pippo = ([ key for key, value in unit_type.items() if key in str(lines) ] or [ key for key, value in unit_type.items() if key in str(file_name) ]).pop()
|
|
except IndexError:
|
|
pippo = 'N/A'
|
|
|
|
|
|
print(pippo)
|