Skip to content

Commit

Permalink
Merge branch 'master' into petar/evm-optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
PetarMax authored Oct 9, 2024
2 parents 575b71f + 1a2ac9e commit f9b367e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/kontrol/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,13 +480,18 @@ def __str__(self) -> str:
The first line collects all attributes that are directly set on the instance.
The loop is required to iterate over all parent classes and fetch attributes set by the `default` method.
Default values from parent classes will only be used if the attribute is not explicitly set.
:return: String representation of the instance.
"""
options_dict = {**self.__dict__}

for parent in self.__class__.__bases__:
if hasattr(parent, 'default'):
options_dict.update(parent.default())
parent_defaults = parent.default()
for key, value in parent_defaults.items():
if key not in options_dict:
options_dict[key] = value

options_str = ', '.join(f'{key}: {value}' for key, value in options_dict.items())
return f'ProveOptions({options_str})'
Expand Down Expand Up @@ -884,13 +889,18 @@ def __str__(self) -> str:
The first line collects all attributes that are directly set on the instance.
The loop is required to iterate over all parent classes and fetch attributes set by the `default` method.
Default values from parent classes will only be used if the attribute is not explicitly set.
:return: String representation of the instance.
"""
options_dict = {**self.__dict__}

for parent in self.__class__.__bases__:
if hasattr(parent, 'default'):
options_dict.update(parent.default())
parent_defaults = parent.default()
for key, value in parent_defaults.items():
if key not in options_dict:
options_dict[key] = value

options_str = ', '.join(f'{key}: {value}' for key, value in options_dict.items())
return f'BuildOptions({options_str})'

0 comments on commit f9b367e

Please sign in to comment.