Skip to content

Commit

Permalink
fix(config): Fix init_kwargs handling
Browse files Browse the repository at this point in the history
  • Loading branch information
fkglr committed Dec 6, 2024
1 parent 2dfbfab commit ab85568
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/gallia/command/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,14 @@ class GalliaBaseModel(BaseCommand, ABC):
__config_registry: dict[str, tuple[str, Any]]

def __init__(self, **data: Any):
# Copy to avoid side effects when reusing init_kwargs
init_kwargs = dict(data.pop("init_kwargs", {}))
init_kwargs = data.pop("init_kwargs", {})

if init_kwargs is None:
init_kwargs = {}
else:
# Copy to avoid side effects when reusing init_kwargs
init_kwargs = dict(init_kwargs)

init_kwargs.update(data)

super().__init__(**init_kwargs)
Expand Down

0 comments on commit ab85568

Please sign in to comment.