Skip to content

Commit

Permalink
fix(json): json.loads now does not write to file
Browse files Browse the repository at this point in the history
Fix #11
  • Loading branch information
LukeSavefrogs committed Nov 3, 2023
1 parent bb93f60 commit 8861d56
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/polyfills/json/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,11 +496,20 @@ def loads(

def load(
fh,
json_str, # type: str
truthy_value=None,
falsy_value=None
):
fh.write(loads(json_str, truthy_value, falsy_value))
""" Deserialize fp (a `.read()`-supporting text file or binary file containing a JSON document) to a Python object.
Args:
fh (file): A File-like object.
truthy_value (bool, optional): The value to use for boolean `true`. Defaults to None.
falsy_value (bool, optional): The value to use for boolean `false`. Defaults to None.
Returns:
Any: The deserialized Python object.
"""
return loads(fh.read(), truthy_value, falsy_value)


def dump(
Expand Down

0 comments on commit 8861d56

Please sign in to comment.