Fix python3.8 support
This commit is contained in:
parent
656f3d8968
commit
141293a75b
1 changed files with 2 additions and 2 deletions
|
@ -55,7 +55,7 @@ def _parse_bool_arg(arg: str | bytes | bool) -> bool:
|
||||||
raise ValueError(f"Invalid boolean argument: {arg}")
|
raise ValueError(f"Invalid boolean argument: {arg}")
|
||||||
|
|
||||||
|
|
||||||
def add_args_from_model(parser: argparse.ArgumentParser, model: type[BaseModel]):
|
def add_args_from_model(parser: argparse.ArgumentParser, model: Type[BaseModel]):
|
||||||
"""Add arguments from a pydantic model to an argparse parser."""
|
"""Add arguments from a pydantic model to an argparse parser."""
|
||||||
|
|
||||||
for name, field in model.model_fields.items():
|
for name, field in model.model_fields.items():
|
||||||
|
@ -83,7 +83,7 @@ def add_args_from_model(parser: argparse.ArgumentParser, model: type[BaseModel])
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
T = TypeVar("T", bound=type[BaseModel])
|
T = TypeVar("T", bound=Type[BaseModel])
|
||||||
|
|
||||||
|
|
||||||
def parse_model_from_args(model: T, args: argparse.Namespace) -> T:
|
def parse_model_from_args(model: T, args: argparse.Namespace) -> T:
|
||||||
|
|
Loading…
Reference in a new issue