diff --git a/moonraker/utils/json_wrapper.py b/moonraker/utils/json_wrapper.py index b97ba91..5ff0dec 100644 --- a/moonraker/utils/json_wrapper.py +++ b/moonraker/utils/json_wrapper.py @@ -10,8 +10,8 @@ import contextlib from typing import Any, Union, TYPE_CHECKING if TYPE_CHECKING: - def dumps(obj: Any) -> bytes: ... # type: ignore - def loads(data: Union[str, bytes, bytearray]) -> Any: ... + def dumps(obj: Any) -> bytes: ... # type: ignore # noqa: E704 + def loads(data: Union[str, bytes, bytearray]) -> Any: ... # noqa: E704 MSGSPEC_ENABLED = False _msgspc_var = os.getenv("MOONRAKER_ENABLE_MSGSPEC", "y").lower() @@ -21,13 +21,13 @@ if _msgspc_var in ["y", "yes", "true"]: from msgspec import DecodeError as JSONDecodeError encoder = msgspec.json.Encoder() decoder = msgspec.json.Decoder() - dumps = encoder.encode - loads = decoder.decode + dumps = encoder.encode # noqa: F811 + loads = decoder.decode # noqa: F811 MSGSPEC_ENABLED = True if not MSGSPEC_ENABLED: import json - from json import JSONDecodeError # type: ignore + from json import JSONDecodeError # type: ignore # noqa: F401,F811 loads = json.loads # type: ignore - def dumps(obj) -> bytes: # type: ignore + def dumps(obj) -> bytes: # type: ignore # noqa: F811 return json.dumps(obj).encode("utf-8")