From 69fa2869ca3ee0cfb8195ff91278aa0123a6f878 Mon Sep 17 00:00:00 2001 From: Aleksei Stepanov Date: Fri, 22 Nov 2019 14:59:37 +0100 Subject: [PATCH] Better type hints for json --- exec_helpers/exec_result.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/exec_helpers/exec_result.py b/exec_helpers/exec_result.py index 27734e8..208f939 100644 --- a/exec_helpers/exec_result.py +++ b/exec_helpers/exec_result.py @@ -533,14 +533,16 @@ def __deserialize(self, fmt: str) -> typing.Any: raise NotImplementedError(msg) @property - def stdout_json(self) -> typing.Any: + def stdout_json( + self, + ) -> typing.Union[typing.Dict[str, typing.Any], typing.List[typing.Any], str, int, float, bool, None]: """JSON from stdout. :rtype: typing.Any :raises DeserializeValueError: STDOUT can not be deserialized as JSON """ with self.stdout_lock: - return self.__deserialize(fmt="json") + return self.__deserialize(fmt="json") # type:ignore @property def stdout_yaml(self) -> typing.Any: