From 7e9959370d140d31862f5e1f24ea33d4a699721a Mon Sep 17 00:00:00 2001 From: dreamer Date: Sun, 20 Oct 2024 14:37:24 +0200 Subject: [PATCH] use Dict --- hvcc/core/hv2ir/types/IR.py | 4 ++-- hvcc/core/hv2ir/types/Lang.py | 2 +- hvcc/interpreters/pd2hv/PdGraph.py | 9 ++++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/hvcc/core/hv2ir/types/IR.py b/hvcc/core/hv2ir/types/IR.py index dc2b9d2b..06169a57 100644 --- a/hvcc/core/hv2ir/types/IR.py +++ b/hvcc/core/hv2ir/types/IR.py @@ -1,5 +1,5 @@ from pydantic import BaseModel, RootModel -from typing import List, Optional, Union, Literal +from typing import Dict, List, Optional, Union, Literal IRConnectionType = Literal["-->", "~i>", "~f>", "signal"] @@ -39,7 +39,7 @@ class IRNode(BaseModel): class HeavyIRType(RootModel): - root: dict[str, IRNode] + root: Dict[str, IRNode] if __name__ == "__main__": diff --git a/hvcc/core/hv2ir/types/Lang.py b/hvcc/core/hv2ir/types/Lang.py index 0f790cbc..2dd9c29f 100644 --- a/hvcc/core/hv2ir/types/Lang.py +++ b/hvcc/core/hv2ir/types/Lang.py @@ -35,7 +35,7 @@ class LangNode(BaseModel): class HeavyLangType(RootModel): - root: dict[str, LangNode] + root: Dict[str, LangNode] if __name__ == "__main__": diff --git a/hvcc/interpreters/pd2hv/PdGraph.py b/hvcc/interpreters/pd2hv/PdGraph.py index e5a1b478..ea0eda25 100644 --- a/hvcc/interpreters/pd2hv/PdGraph.py +++ b/hvcc/interpreters/pd2hv/PdGraph.py @@ -118,7 +118,14 @@ def add_parsed_connection(self, from_index: int, from_outlet: int, to_index: int "Have all inlets and outlets been declared?", NotificationEnum.ERROR_UNABLE_TO_CONNECT_OBJECTS) - def add_hv_arg(self, arg_index: int, name: str, value_type: str, default_value: str, required: bool) -> None: + def add_hv_arg( + self, + arg_index: int, + name: str, + value_type: str, + default_value: Optional[str], + required: bool + ) -> None: """ Add a Heavy argument to the graph. Indicies are from zero (not one, like Pd). """ # ensure that self.hv_args is big enough, as heavy arguments are not