ruff fix
This commit is contained in:
@@ -49,20 +49,20 @@ class Config:
|
||||
self.dbnodes = c.get("tables", "nodesTableName")
|
||||
|
||||
# unit setting
|
||||
self.units_name = [part for part in c.get("unit", "Names").split("|")]
|
||||
self.units_type = [part for part in c.get("unit", "Types").split("|")]
|
||||
self.units_name = list(c.get("unit", "Names").split("|"))
|
||||
self.units_type = list(c.get("unit", "Types").split("|"))
|
||||
self.units_alias = {key: value for item in c.get("unit", "Alias").split("|") for key, value in [item.split(":", 1)]}
|
||||
# self.units_header = {key: int(value) for pair in c.get("unit", "Headers").split('|') for key, value in [pair.split(':')]}
|
||||
|
||||
# tool setting
|
||||
self.tools_name = [part for part in c.get("tool", "Names").split("|")]
|
||||
self.tools_type = [part for part in c.get("tool", "Types").split("|")]
|
||||
self.tools_name = list(c.get("tool", "Names").split("|"))
|
||||
self.tools_type = list(c.get("tool", "Types").split("|"))
|
||||
self.tools_alias = {
|
||||
key: key if value == "=" else value for item in c.get("tool", "Alias").split("|") for key, value in [item.split(":", 1)]
|
||||
}
|
||||
|
||||
# csv info
|
||||
self.csv_infos = [part for part in c.get("csv", "Infos").split("|")]
|
||||
self.csv_infos = list(c.get("csv", "Infos").split("|"))
|
||||
|
||||
# TS pini path match
|
||||
self.ts_pini_path_match = {
|
||||
|
||||
@@ -37,7 +37,7 @@ class Config:
|
||||
self.dbnodes = c.get("tables", "nodesTableName")
|
||||
|
||||
# Tool
|
||||
self.elab_status = [part for part in c.get("tool", "elab_status").split("|")]
|
||||
self.elab_status = list(c.get("tool", "elab_status").split("|"))
|
||||
|
||||
# Matlab
|
||||
self.matlab_runtime = c.get("matlab", "runtime")
|
||||
|
||||
@@ -42,7 +42,8 @@ def on_file_received(self: object, file: str) -> None:
|
||||
tool_type = extract_value(cfg.tools_type, filename, str(lines[0:10]))
|
||||
tool_info = "{}"
|
||||
|
||||
# se esiste l'alias in alias_unit_type, allora prende il valore dell'alias... verifica sia lo unit_type completo che i primi 3 caratteri per CO_xxxxx
|
||||
# se esiste l'alias in alias_unit_type, allora prende il valore dell'alias
|
||||
# verifica sia lo unit_type completo che i primi 3 caratteri per CO_xxxxx
|
||||
upper_unit_type = unit_type.upper()
|
||||
unit_type = cfg.units_alias.get(upper_unit_type) or cfg.units_alias.get(upper_unit_type[:3]) or upper_unit_type
|
||||
upper_tool_type = tool_type.upper()
|
||||
@@ -75,7 +76,9 @@ def on_file_received(self: object, file: str) -> None:
|
||||
|
||||
try:
|
||||
cur.execute(
|
||||
f"INSERT INTO {cfg.dbname}.{cfg.dbrectable} (username, filename, unit_name, unit_type, tool_name, tool_type, tool_data, tool_info) VALUES (%s,%s, %s, %s, %s, %s, %s, %s)",
|
||||
f"""INSERT INTO {cfg.dbname}.{cfg.dbrectable}
|
||||
(username, filename, unit_name, unit_type, tool_name, tool_type, tool_data, tool_info)
|
||||
VALUES (%s,%s, %s, %s, %s, %s, %s, %s)""",
|
||||
(
|
||||
self.username,
|
||||
new_filename,
|
||||
|
||||
@@ -47,7 +47,6 @@ class FTPConnection:
|
||||
|
||||
|
||||
async def ftp_send_raw_csv_to_customer(cfg: dict, id: int, unit: str, tool: str, pool: object) -> bool:
|
||||
None
|
||||
return True
|
||||
|
||||
|
||||
|
||||
@@ -46,7 +46,8 @@ def ftp_SITE_ADDU(self: object, line: str) -> None:
|
||||
# Create a cursor
|
||||
cur = conn.cursor()
|
||||
cur.execute(
|
||||
f"INSERT INTO {cfg.dbname}.{cfg.dbusertable} (ftpuser, hash, virtpath, perm) VALUES ('{user}', '{hash}', '{cfg.virtpath + user}', '{cfg.defperm}')"
|
||||
f"""INSERT INTO {cfg.dbname}.{cfg.dbusertable} (ftpuser, hash, virtpath, perm)
|
||||
VALUES ('{user}', '{hash}', '{cfg.virtpath + user}', '{cfg.defperm}')"""
|
||||
)
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
Reference in New Issue
Block a user