Skip to content

Commit

Permalink
Add rudimentary parsing of literals to PET driver (i-pi#341)
Browse files Browse the repository at this point in the history
This is needed to pass non-strings such as None,
True, or False into the SingleStructCalculator.

I've drawn the line at floats and ints, because
it is not so easy to programmatically distinguish
them, and it's not always clear what the intended
type is supposed to be.
  • Loading branch information
sirmarcel authored Jun 4, 2024
1 parent 2d74d4a commit 453fa33
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/py/pes/pet.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ def check_arguments(self):
if len(args) > 2:
for arg in args[2:]:
key, value = arg.split("=")
lookup = {
"None": None,
"False": False,
"True": True,
}

if value in lookup:
value = lookup[value]

kwargs[key] = value

else:
Expand Down

0 comments on commit 453fa33

Please sign in to comment.