Skip to content

Commit

Permalink
Fix typing error in libcoap_api (#476)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggravlingen authored Apr 15, 2022
1 parent 1d716f3 commit 3d5d84c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pytradfri/api/libcoap_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
from time import time
from typing import TYPE_CHECKING, Any, Dict, List, Union, cast, overload

from aiocoap import Message

from ..command import Command, T
from ..error import ClientError, RequestError, RequestTimeout, ServerError
from ..gateway import Gateway
Expand Down Expand Up @@ -213,7 +211,7 @@ def generate_psk(self, security_key: str) -> str:


def _process_output(
output: Message, parse_json: bool = True
output: str, parse_json: bool = True
) -> list[Any] | dict[Any, Any] | str | None:
"""Process output."""
output = output.strip()
Expand All @@ -232,5 +230,5 @@ def _process_output(
if output.startswith(SERVER_ERROR_PREFIX):
raise ServerError(output)
if not parse_json:
return cast(str, output)
return output
return cast(Union[Dict[Any, Any], List[Any]], json.loads(output))

0 comments on commit 3d5d84c

Please sign in to comment.