Don't warn about file if not reading from a file

Leave that up to the other log messages
This commit is contained in:
awsr
2025-12-28 03:10:22 -08:00
committed by GitHub
parent 89fd729d74
commit 7c01fd71de
+2 -2
View File
@@ -59,17 +59,17 @@ def readfile(filename: str, silent: bool = False, lock: bool = False, *, as_type
except Exception:
locking_available = False
if isinstance(data, list) and as_type == "dict":
log.warning(f"Read: Expected dictionary from '{filename}' but got list")
if not data:
return {}
log.warning(f"Read: Expected dictionary from '{filename}' but got list")
data0 = data[0]
if isinstance(data0, dict):
return data0
return {}
if isinstance(data, dict) and as_type == "list":
log.warning(f"Read: Expected list from '{filename}' but got dictionary")
if not data:
return []
log.warning(f"Read: Expected list from '{filename}' but got dictionary")
return [data]
return data