Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 1, 2024
1 parent 54dd1ed commit 4295a37
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions znframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def to_atoms(self) -> ase.Atoms:

return atoms

def to_dict(self, built_in_types: bool = True, json_serializable = False) -> dict:
def to_dict(self, built_in_types: bool = True, json_serializable=False) -> dict:
data = attrs.asdict(self, filter=lambda attr, _: attr.name != "recompute")
if not built_in_types:
data = _ndarray_to_list(data)
Expand Down Expand Up @@ -222,7 +222,10 @@ def get_radius(value):

def default_serializer(obj):
for key, value in list(obj.items()):
if not isinstance(value, (int, float, str, list, dict, bool)) and value is not None:
if (
not isinstance(value, (int, float, str, list, dict, bool))
and value is not None
):
print("Warning: {} is not JSON serializable".format(type(value)))
del obj[key]
elif isinstance(value, dict):
Expand Down

0 comments on commit 4295a37

Please sign in to comment.