Esempio n. 1
0
def save_blob_as_json(filename, blob, force_write):
    """
    Creates/Modifies file and saves python object as JSON

    :param filename:
    :param blob:
    :param force_write:

    :return:
    """
    try:
        if prompt_overwrite(filename, force_write):
            with open(filename, 'wt') as f:
                print_info('%s' % json.dumps(blob,
                                             indent=4,
                                             separators=(',', ': '),
                                             sort_keys=True,
                                             cls=CustomJSONEncoder))
    except Exception as e:
        print_exception(e)
Esempio n. 2
0
 def test_prompt_overwrite(self):
     assert (prompt_overwrite('', True, None))