Compare commits
2 Commits
89211b21c6
...
704bc20456
| Author | SHA1 | Date | |
|---|---|---|---|
| 704bc20456 | |||
| 610e87c1d1 |
@@ -102,11 +102,11 @@ class ASEHandler(FTPHandler):
|
||||
with open(file, 'r') as csvfile:
|
||||
lines = csvfile.readlines()
|
||||
|
||||
unit_types = cfg.headers.keys()
|
||||
unit_type = extract_value(unit_types, filename, str(lines[0:300]))
|
||||
unit_name = extract_value(cfg.unit_names, filename, str(lines[0:300]))
|
||||
tool_name = extract_value(cfg.tool_names, filename, str(lines[0:300]))
|
||||
tool_type = extract_value(cfg.tool_types, filename, str(lines[0:300]))
|
||||
units_type = cfg.headers.keys()
|
||||
unit_type = extract_value(units_type, filename, str(lines[0:6]))
|
||||
unit_name = extract_value(cfg.units_name, filename, str(lines[0:6]))
|
||||
tool_name = extract_value(cfg.tools_name, filename, str(lines[0:6]))
|
||||
tool_type = extract_value(cfg.tools_type, filename, str(lines[0:6]))
|
||||
|
||||
conn = conn_db(cfg)
|
||||
|
||||
|
||||
@@ -34,5 +34,5 @@
|
||||
Names = ID[0-9]{4}|IX[0-9]{4}
|
||||
|
||||
[tool]
|
||||
Types = MUX|MUMS|MODB|IPTM
|
||||
Types = MUX|MUMS|MODB|IPTM|MUSA
|
||||
Names = LOC[0-9]{4}|DT[0-9]{4}
|
||||
|
||||
34
prova.py
34
prova.py
@@ -1,34 +0,0 @@
|
||||
#!/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)
|
||||
@@ -39,8 +39,8 @@ class config:
|
||||
|
||||
# unit setting
|
||||
self.headers = {key: int(value) for pair in c.get("unit", "Headers").split('|') for key, value in [pair.split(':')]}
|
||||
self.unit_names = [part for part in c.get("unit", "Names").split('|')]
|
||||
self.units_name = [part for part in c.get("unit", "Names").split('|')]
|
||||
|
||||
# tool setting
|
||||
self.tool_names = [part for part in c.get("tool", "Names").split('|')]
|
||||
self.tool_types = [part for part in c.get("tool", "Types").split('|')]
|
||||
self.tools_name = [part for part in c.get("tool", "Names").split('|')]
|
||||
self.tools_type = [part for part in c.get("tool", "Types").split('|')]
|
||||
|
||||
Reference in New Issue
Block a user