-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
785 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 7 additions & 6 deletions
13
hugr-py/src/hugr/serialization/hugrtype.py → ...py/src/hugr/serialization/testing_hugr.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
from typing import Any, Literal | ||
from pydantic import BaseModel, Field | ||
from .tys import Type, USize, SumTypeBase | ||
from .tys import Type, USize, SumType | ||
from .ops import Value | ||
|
||
|
||
class HugrType(BaseModel): | ||
"""A serializable representation of a Hugr Type. Intended for testing only.""" | ||
class TestingHugr(BaseModel): | ||
"""A serializable representation of a Hugr Type, SumType, or Value. Intended for testing only.""" | ||
|
||
typ: Type | SumTypeBase | ||
version: Literal["v1"] = "v1" | ||
typ: Type | SumType | Value | ||
version: Literal["v2"] = "v2" | ||
|
||
@classmethod | ||
def get_version(cls) -> str: | ||
"""Return the version of the schema.""" | ||
return cls(typ=Type(USize())).version | ||
|
||
class Config: | ||
title = "HugrType" | ||
title = "HugrTesting" | ||
json_schema_extra = { | ||
"required": ["typ"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.