refactor: Update Log message field to allow list type
Update the Log class in schema.py to allow the message field to accept a list type in addition to str, dict, and StreamURL. This change enhances the flexibility of the Log class and accommodates scenarios where multiple messages need to be stored.
This commit is contained in:
parent
2a1c6e76a5
commit
dc37f279e0
1 changed files with 6 additions and 3 deletions
|
|
@ -1,5 +1,5 @@
|
|||
from collections import defaultdict
|
||||
from typing import Literal
|
||||
from typing import Any, Literal
|
||||
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ class StreamURL(TypedDict):
|
|||
|
||||
|
||||
class Log(TypedDict):
|
||||
message: str | dict | StreamURL
|
||||
message: str | dict | StreamURL | list
|
||||
type: str
|
||||
|
||||
|
||||
|
|
@ -33,5 +33,8 @@ def build_logs_from_artifacts(artifacts: dict) -> dict:
|
|||
log = Log(message=message, type=message["type"])
|
||||
|
||||
logs[key].append(log)
|
||||
|
||||
return logs
|
||||
|
||||
|
||||
def build_log_from_raw_and_type(raw: Any, log_type: str) -> Log:
|
||||
return Log(message=raw, type=log_type)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue