Skip to content

Commit

Permalink
v0.1.1: bugfix for pydantic model root validator (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
cahna authored Jan 31, 2023
1 parent 1e29b00 commit db2db67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions hitfactorpy/pydantic_/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ def _coerce_time_into_decimal(cls, v):
@root_validator(pre=True)
def _coerce_hit_factor_to_decimal_or_calculate_if_unset(cls, values):
hit_factor = values.get("hit_factor")
if hit_factor is None:
values["hit_factor"] = calculate_hit_factor(**values)
else:
values["hit_factor"] = D4(hit_factor)
return values
return {
**values,
"hit_factor": calculate_hit_factor(**values) if hit_factor is None else D4(hit_factor),
}

@root_validator
def _check_hit_factor_matches_calculated_hit_factor(cls, values):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "hitfactorpy"
version = "0.1.0"
version = "0.1.1"
description = "Python tools for parsing and analyzing practical match reports"
authors = ["Conor Heine <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit db2db67

Please sign in to comment.