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

Commit

Permalink
Fix codejail numpy encoder for
Browse files Browse the repository at this point in the history
  • Loading branch information
antoineKorbit committed Mar 18, 2022
1 parent 954acf0 commit 1d437b4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions codejail/custom_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def default(self, obj):
elif type(obj).__module__ == 'pandas':
if hasattr(obj, 'to_json'):
return obj.to_json(orient='records')
return repr(obj)
return json.JSONEncoder.default(self, obj)


Expand All @@ -28,6 +29,5 @@ def default(self, obj):
return obj.tolist()
elif isinstance(obj, (np.bool_)):
return bool(obj)
elif isinstance(obj, (np.void)):
return None
return json.JSONEncoder.default(self, obj)
return json.JSONEncoder.default(self, repr(obj))

0 comments on commit 1d437b4

Please sign in to comment.