Skip to content

Commit

Permalink
Fix pydanitc create_model usage.
Browse files Browse the repository at this point in the history
Fixes awslabs#767

The `model_name` argument was renamed to `__model_name` in
[1367](pydantic/pydantic#1367).

This change ensure that our code works with both future and past
versions of pydantic.
  • Loading branch information
jaheba committed Apr 19, 2020
1 parent 0143054 commit f21fd20
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/gluonts/core/component.py
Expand Up @@ -389,15 +389,13 @@ def validator(init):

if base_model is None:
PydanticModel = create_model(
model_name=f"{init_clsnme}Model",
f"{init_clsnme}Model",
__config__=BaseValidatedInitializerModel.Config,
**init_fields,
)
else:
PydanticModel = create_model(
model_name=f"{init_clsnme}Model",
__base__=base_model,
**init_fields,
f"{init_clsnme}Model", __base__=base_model, **init_fields,
)

def validated_repr(self) -> str:
Expand Down

0 comments on commit f21fd20

Please sign in to comment.