Skip to content

Commit

Permalink
to_dict method of DefaultFilters also takes default None values
Browse files Browse the repository at this point in the history
  • Loading branch information
comane committed May 16, 2024
1 parent ca3e56f commit 76fe516
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions validphys2/src/validphys/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ class FilterDefaults:
maxTau: float = None

def to_dict(self):
default_dict = dataclasses.asdict(self)
filtered_dict = {k: v for k, v in default_dict.items() if v is not None}
return filtered_dict
return dataclasses.asdict(self)


@dataclasses.dataclass(frozen=True)
Expand Down Expand Up @@ -517,8 +515,7 @@ def __init__(self, initial_data: FilterRule, *, defaults: dict, theory_parameter
elif isinstance(initial_data, Mapping):
initial_data = dict(initial_data)
else:
raise RuleProcessingError("Expecting initial_data to be an instance of a FilterRule dataclass, \
Mappings are also supported.")
raise RuleProcessingError("Expecting initial_data to be an instance of a FilterRule dataclass.")

for key in initial_data:
setattr(self, key, initial_data[key])
Expand Down

0 comments on commit 76fe516

Please sign in to comment.