bibliopixel.util.data_file module¶
-
bibliopixel.util.data_file.
dump
(data, file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, use_yaml=None, **kwds)[source]¶ Dumps data as nicely formatted JSON string to a file or file handle
Parameters: - data (dict) – a dictionary to dump
- file – a filename or file handle to write to
- kwds – keywords to pass to json.dump
-
bibliopixel.util.data_file.
dumps
(data, use_yaml=None, safe=True, **kwds)[source]¶ Dumps data into a nicely formatted JSON string.
Parameters: - data (dict) – a dictionary to dump
- kwds – keywords to pass to json.dumps
Returns: a string with formatted data
Return type: str
-
bibliopixel.util.data_file.
load
(file, use_yaml=None)[source]¶ Loads not only JSON files but also YAML files ending in .yml.
Parameters: file – a filename or file handle to read from Returns: the data loaded from the JSON or YAML file Return type: dict