mehrere oft verwendete Routinen in eigene utils.py eingebaut

This commit is contained in:
2026-01-23 10:23:18 +01:00
parent 37208f61b1
commit 3deebb81f3
9 changed files with 453 additions and 175 deletions
+2 -16
View File
@@ -5,6 +5,8 @@ from ioconverter import ExcelConverter
import json
from pathlib import Path
from utils import check_file_in_work, load_json
def process_item(sname, sdata):
data = {
"id": sdata.get("IO", ""),
@@ -57,22 +59,6 @@ def prepare_data(rawdata:dict):
return (dsensors, lsensors)
# einfache Funktionen
def load_json(jsonfilename):
with open(jsonfilename, encoding='utf-8') as fh:
return json.load(fh)
def check_file_in_work(work_dir:Path, filename:Path):
fexists = True
if not filename.exists(): # dann schau im Work Ordner nach
mypath = work_dir.joinpath(filename)
ex = mypath.exists()
if not mypath.exists():
fexists = False
else:
mypath = filename
return (mypath, fexists)
# Helper zum Laden der Error-JSON
def load_error_json(json_path: Path, work_dir: Path):
"""