-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add type hints to the utilities module (#1252)
* Add type hints to json.py * Update MyPy ini file to include the utilities module * Add type hints to decimal_places.py * Add type hints to metadata_parser.py * Add type hints to metadata_parser_v2.py * Add type hints to metadata_validators.py * Add type hints to request_session.py * Add type hints to schema.py * Add type hints to supplementary_data_parser.py * Format python code * Fix variable name issue * Tidy up pylint comments * Add more type hint definitions * test new changes to ensure the deserialize method uses default format (iso8601) unless a format is specified * Tidy up type hints and add missing hints for empty collection * Refactor code to improve type hints * Refactor/improve type hints and install new dev package * Refactor more type hints * Update type ignore message * Fix type hinting * Correct type hint for parameter * Remove types-simplejson package * Revert pipfiles * Revert pipfile.lock
- Loading branch information
1 parent
eda53b9
commit a1a0b10
Showing
10 changed files
with
122 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
from typing import IO, Any | ||
|
||
import simplejson as json | ||
|
||
|
||
def json_load(file, **kwargs): | ||
def json_load(file: IO[str], **kwargs: Any) -> Any: | ||
return json.load(file, use_decimal=True, **kwargs) | ||
|
||
|
||
def json_loads(data, **kwargs): | ||
def json_loads(data: str, **kwargs: Any) -> Any: | ||
return json.loads(data, use_decimal=True, **kwargs) | ||
|
||
|
||
def json_dumps(data, **kwargs) -> str: | ||
def json_dumps(data: Any, **kwargs: Any) -> str: | ||
return json.dumps(data, for_json=True, use_decimal=True, **kwargs) |
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.