Skip to content

Commit

Permalink
#26 use get_args
Browse files Browse the repository at this point in the history
  • Loading branch information
rtimms committed Oct 5, 2023
1 parent fc38062 commit f116efd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bpx/schema.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List, Literal, Union, Dict
from typing import List, Literal, Union, Dict, get_args
from pydantic import BaseModel, Field, Extra, root_validator
from bpx import Function, InterpolatedTable
from warnings import warn
Expand Down Expand Up @@ -288,7 +288,7 @@ def __init__(Self, **data):
@root_validator(pre=True)
def validate_extra_fields(cls, values):
for k, v in values.items():
if not isinstance(v, (float, Function, InterpolatedTable)):
if not isinstance(v, get_args(FloatFunctionTable)):
raise TypeError(f"{k} must be of type 'FloatFunctionTable'")
return values

Expand Down

0 comments on commit f116efd

Please sign in to comment.