mehrere oft verwendete Routinen in eigene utils.py eingebaut
This commit is contained in:
+2
-16
@@ -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):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user