Revert "Initial orjson support (#72754)" (#72789)

This was causing the wheels to fail to build. We need
to workout why when we don't have release pressure

This reverts commit d9d22a9556.
This commit is contained in:
J. Nick Koston
2022-05-31 10:51:55 -10:00
committed by GitHub
parent 9cea936c22
commit c365454afb
18 changed files with 67 additions and 127 deletions

View File

@@ -7,8 +7,6 @@ import json
import logging
from typing import Any
import orjson
from homeassistant.core import Event, State
from homeassistant.exceptions import HomeAssistantError
@@ -32,7 +30,7 @@ def load_json(filename: str, default: list | dict | None = None) -> list | dict:
"""
try:
with open(filename, encoding="utf-8") as fdesc:
return orjson.loads(fdesc.read()) # type: ignore[no-any-return]
return json.loads(fdesc.read()) # type: ignore[no-any-return]
except FileNotFoundError:
# This is not a fatal error
_LOGGER.debug("JSON file not found: %s", filename)
@@ -58,10 +56,7 @@ def save_json(
Returns True on success.
"""
try:
if encoder:
json_data = json.dumps(data, indent=2, cls=encoder)
else:
json_data = orjson.dumps(data, option=orjson.OPT_INDENT_2).decode("utf-8")
json_data = json.dumps(data, indent=4, cls=encoder)
except TypeError as error:
msg = f"Failed to serialize to JSON: {filename}. Bad data at {format_unserializable_data(find_paths_unserializable_data(data))}"
_LOGGER.error(msg)