Skip to content

Commit

Permalink
Merge pull request #119 from SNEWS2/minor_patch_pval
Browse files Browse the repository at this point in the history
pval is not a required arg, don't crash
  • Loading branch information
sybenzvi authored Aug 15, 2024
2 parents ab176e1 + 4237855 commit d6421f4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions snews_pt/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ def is_valid(self):

# p_val must be a float between 0 and 1
pv = self.message_data['p_val']
if pv is None:
# it is not a required argument, check only if it is not None
return True
if isinstance(pv, str):
pv = float(pv)
if not (0.0 <= pv <= 1.0):
Expand Down Expand Up @@ -356,6 +359,9 @@ def is_valid(self):

# p_val must be a float between 0 and 1
pv = self.message_data['p_val']
if pv is None:
# it is not a required argument, check only if it is not None
return True
if isinstance(pv, str):
pv = float(pv)
if not (0.0 <= pv <= 1.0):
Expand Down

0 comments on commit d6421f4

Please sign in to comment.