From 48e40670af0a5822ceb6312c2607f07e9898fe5b Mon Sep 17 00:00:00 2001 From: wuyiqunLu Date: Fri, 6 Sep 2024 13:53:56 +0800 Subject: [PATCH 1/4] feat: make logs json searializable --- vision_agent/utils/execute.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vision_agent/utils/execute.py b/vision_agent/utils/execute.py index 0de10335..270cd0bb 100644 --- a/vision_agent/utils/execute.py +++ b/vision_agent/utils/execute.py @@ -243,6 +243,9 @@ def __str__(self) -> str: f"----- stdout -----\n{stdout_str}\n----- stderr -----\n{stderr_str}" ) + def to_json(self) -> str: + return str(self) + class Error(BaseModel): """Represents an error that occurred during the execution of a cell. The error From 25bd7c8de423296debad0a0031c25fac5c0addf3 Mon Sep 17 00:00:00 2001 From: wuyiqunLu Date: Fri, 6 Sep 2024 15:38:56 +0800 Subject: [PATCH 2/4] change to json format --- vision_agent/utils/execute.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vision_agent/utils/execute.py b/vision_agent/utils/execute.py index 270cd0bb..8bed99fa 100644 --- a/vision_agent/utils/execute.py +++ b/vision_agent/utils/execute.py @@ -7,6 +7,7 @@ import sys import traceback import warnings +import json from enum import Enum from pathlib import Path from time import sleep @@ -243,8 +244,8 @@ def __str__(self) -> str: f"----- stdout -----\n{stdout_str}\n----- stderr -----\n{stderr_str}" ) - def to_json(self) -> str: - return str(self) + def to_json(self) -> bytes: + return {"stdout": self.stdout, "stderr": self.stderr} class Error(BaseModel): From 1efbc33e3c0d54c988ebf228a0eb0d58d830b674 Mon Sep 17 00:00:00 2001 From: wuyiqunLu Date: Fri, 6 Sep 2024 15:40:23 +0800 Subject: [PATCH 3/4] remove unused pkg --- vision_agent/utils/execute.py | 1 - 1 file changed, 1 deletion(-) diff --git a/vision_agent/utils/execute.py b/vision_agent/utils/execute.py index 8bed99fa..7633fa33 100644 --- a/vision_agent/utils/execute.py +++ b/vision_agent/utils/execute.py @@ -7,7 +7,6 @@ import sys import traceback import warnings -import json from enum import Enum from pathlib import Path from time import sleep From ecfdad18ec96c04f5e45d31d20f770133704f9a3 Mon Sep 17 00:00:00 2001 From: wuyiqunLu Date: Sat, 7 Sep 2024 23:10:00 +0800 Subject: [PATCH 4/4] fix lint --- vision_agent/utils/execute.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vision_agent/utils/execute.py b/vision_agent/utils/execute.py index 7633fa33..7967367e 100644 --- a/vision_agent/utils/execute.py +++ b/vision_agent/utils/execute.py @@ -243,7 +243,7 @@ def __str__(self) -> str: f"----- stdout -----\n{stdout_str}\n----- stderr -----\n{stderr_str}" ) - def to_json(self) -> bytes: + def to_json(self) -> dict[str, list[str]]: return {"stdout": self.stdout, "stderr": self.stderr}