Skip to content

Commit

Permalink
expand types
Browse files Browse the repository at this point in the history
  • Loading branch information
dromer committed Oct 19, 2024
1 parent 8f6c58d commit 8e4d700
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
9 changes: 6 additions & 3 deletions hvcc/core/json/heavy_ir.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from pydantic import BaseModel, RootModel
from typing import List, Optional, Union
from typing import List, Optional, Union, Literal


ConnectionType = Literal["-->", "~i>", "~f>", "signal"]


class Arg(BaseModel):
Expand All @@ -23,9 +26,9 @@ class Perf(BaseModel):


class IRNode(BaseModel):
inlets: List[str]
inlets: List[ConnectionType]
ir: IR
outlets: List[str]
outlets: List[ConnectionType]
args: List[Arg] = []
perf: Optional[Perf] = Perf()
# perf: Perf
Expand Down
21 changes: 12 additions & 9 deletions hvcc/core/json/heavy_lang.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
from pydantic import BaseModel, RootModel
from typing import List, Optional, Any
from typing import List, Optional, Dict, Literal, Union


class Inlet(BaseModel):
ConnectionType = Literal["-->", "-~>", "~f>"]


class Arg(BaseModel):
name: str
connectionType: str
value_type: Optional[str]
description: str
default: Union[float, int, str, Dict, List, None] = None
required: bool


class Outlet(BaseModel):
class Inlet(BaseModel):
name: str
connectionType: str
connectionType: ConnectionType
description: str


class Arg(BaseModel):
class Outlet(BaseModel):
name: str
value_type: Optional[str]
connectionType: ConnectionType
description: str
default: Any
required: bool


class LangNode(BaseModel):
Expand Down

0 comments on commit 8e4d700

Please sign in to comment.