Skip to content

Commit

Permalink
Use discriminated union for nodetype (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
nsmith- authored Jan 15, 2025
1 parent b07c2b4 commit 78f94f6
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/correctionlib/schemav2.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,18 @@ def __rich__(self) -> str:

# py3.7+: ForwardRef can be used instead of strings
Content = Union[
"Binning",
"MultiBinning",
"Category",
"Formula",
"FormulaRef",
"Transform",
"HashPRNG",
Annotated[
Union[
"Binning",
"MultiBinning",
"Category",
"Formula",
"FormulaRef",
"Transform",
"HashPRNG",
],
Field(discriminator="nodetype"),
],
float,
]

Expand Down

0 comments on commit 78f94f6

Please sign in to comment.