forked from aiidateam/aiida-core
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dependencies: remove
simplejson
(aiidateam#5391)
This library was used as a drop-in replacement for the `json` module of the standard library to provide consistency of JSON (de)serializing between Python 2 and Python 3. Since we have long since dropped support for Python 2, we can now simply use the standard library. The module `aiida.common.json` provided an interface to `simplejson` and was used throughout `aiida-core` instead of `json`. This module is now deprecated and `aiida-core` just uses `json` directly. There are three significant changes that needed to be taken into account: * `simplejson` provided automatic serialization for `decimal.Decimal` but `json` does not. The support for serializing these types to the database is maintained by performing the serialization manually in the `aiida.orm.implementation.utils.clean_value` method. All instances of `decimal.Decimal` are serialized as `numbers.Real`, e.g. floats, so the behavior should remain the same. * The `aiida.common.json` wrapper functions `dump` and `load` accepted file objects in text and binary mode. However, the `json` analogues only support text files. The wrapper functions therefore had to be adapted to decode and encode, respectively, the contents of the file handle before passing it to the `json` function. * The code that calls `json.dump` passing a handle from a temporary file generated with `tempfile.NamedTemporaryFile` had to be updated to wrap the handle in `codecs.getwriter('utf-8')` since the default mode for `NamedTemporaryFile` is `w+b` and `json.dump` requires a text file handle. Finally, the `aiida.common.json` module is deprecated and will emit a deprecation warning when it is imported.
- Loading branch information
Showing
30 changed files
with
85 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.