Exports a json file that contains all the information of the current Profile.

        :ivar str fileName: The name of the output file to be exported.
351188
def exportJsonFile(self, fileName):
        

        # Because our Profile class is not directly JSON serializable, we exporrt the underlying 
        # dictionary. 
        data = dict()
        for key in self.__dict__.keys():
            if key != "preferences":
                data[key] = self.__dict__[key]
        
        # The Preference class is also not directly JSON serializable, so we export the underlying
        # dictionary for each Preference object.
        preferenceDicts = []
        for preference in self.preferences:
            preferenceDict = dict()
            for key in preference.__dict__.keys():
                preferenceDict[key] = preference.__dict__[key]
            preferenceDicts.append(preferenceDict)
        data["preferences"] = preferenceDicts

        outfile = open(fileName, 'w')
        json.dump(data, outfile)
        outfile.close()
166751
def json_pretty_dump(obj, filename):
    
    with open(filename, "wt") as fh:
        json.dump(obj, fh, indent=4, sort_keys=4)
1129974
def save(self, filename):
        ''' 
        '''
        with open(filename, 'w') as outfile:
            json.dump(self.to_json(), outfile)
704512
def dump(obj, path, **kw):
    
    open_kw = {'mode': 'w'}
    if PY3:  # pragma: no cover
        open_kw['encoding'] = 'utf-8'

    # avoid indented lines ending with ", " on PY2
    if kw.get('indent') and kw.get('separators') is None:
        kw['separators'] = (',', ': ')

    with open(str(path), **open_kw) as fp:
        return json.dump(obj, fp, **kw)
480759
def export_json_object(dict_obj, filename=None):
    
    try:
        if filename:
            try:
                with open(filename, 'w') as handle:
                    handle.write(json.dumps(dict_obj, indent=4, sort_keys=True))
                    logger.info(
                        '%s: Wrote %s to local filesystem location' %
                        (inspect.stack()[0][3], filename))
                handle.close()
            except TypeError as e:
                logger.warning(
                    '%s: object in dict not serializable: %s' %
                    (inspect.stack()[0][3], str(e)))
        else:
            json_str = json.dumps(dict_obj, indent=4, sort_keys=True)
            print(highlight(json_str, lexers.JsonLexer(), formatters.TerminalFormatter()))
            logger.info('%s: successful export to stdout' % inspect.stack()[0][3])
            return True
    except IOError as e:
        logger.critical(
            '%s: export_file_object: error writing to %s to filesystem. Error: %s' %
            (inspect.stack()[0][3], filename, str(e)))
        return False
    else:
        logger.info('export_file_object: successful export to %s' % filename)
        return True
1296382
def save(self, filename):
		'''  '''

		import json
		f = open(filename, 'w')
		json.dump(self.settings, f, indent = 4)
		f.close()
865402
def write_json_file(argname, cmd, basename, filename):
    

    value = getattr(cmd.distribution, argname, None)

    if isinstance(value, dict):
        value = json.dumps(
            value, indent=4, sort_keys=True, separators=(',', ': '))

    cmd.write_or_delete_file(argname, filename, value, force=True)
168107
def beautify(filename=None, json_str=None):
    
    if filename is not None:
        with open(filename) as json_file:
            json_str = json.load(json_file)

    return  json.dumps(json_str, indent=4, sort_keys=True)
267412
def write_options_to_JSON(self, filename):
        
        fd = open(filename, "w")
        fd.write(json.dumps(_options_to_dict(self.gc), indent=2,
                            separators=(',', ': ')))
        fd.close()
85665
def _load_file(self):
        

        if not os.path.exists(self.file):
            return {}

        with open(self.file, "r") as infile:
            data = json.load(infile)

        return data
114847
def save(self, filename, incl_uniqueid=False):
        
        filename = os.path.expanduser(filename)
        f = open(filename, 'w')
        json.dump(self.to_json(incl_uniqueid=incl_uniqueid), f,
                   sort_keys=True, indent=0, separators=(',', ': '))
        f.close()

        return filename
489024
def write_json(data, filename):
    

    def custom_default(obj):
        if obj is None or (hasattr(obj, 'isNull') and obj.isNull()):
            return ''
        raise TypeError

    with open(filename, 'w') as json_file:
        json.dump(data, json_file, indent=2, default=custom_default)
255493
def dumps(self) -> str:
        
        return json.dumps(self.data, sort_keys=True, indent=4)
1295700
def rm_output_json_file():
    
    path = get_output_json_file()
    try:
        os.remove(path)
    except OSError as e:
        if e.errno == errno.ENOENT:
            pass
        else:
            raise
1244972
def exportProfile(self, profile, filename=None):
        
        if not filename:
            filename = QFileDialog.getSaveFileName(self,
                                                   'Export Profile',
                                                   '',
                                                   'XML Files (*.xml)')
            if type(filename) == tuple:
                filename = nativestring(filename[0])
        
        if not filename:
            return False
        
        profile.save(filename)
        return True
1223028
def save_profile(self, profile):
        
        profile = profile.replace('.json', '')
        profile_path = os.path.join(
            self.root_directory,
            'minimum_needs',
            profile + '.json'
        )
        self.write_to_file(profile_path)
710522
def profile_network(filename):
    
    log = logging.getLogger(filename)
    logfile = os.path.join(LOGS, filename + '.log')
    os.makedirs(os.path.dirname(logfile), exist_ok=True)
    handler = logging.FileHandler(logfile)
    handler.setFormatter(formatter)
    log.addHandler(handler)
    log.setLevel(logging.INFO)

    try:
        with open(os.path.join(NETWORKS, filename + '.json')) as f:

            network, state = load_json_network(json.load(f))

            log.info('Profiling %s...', filename)
            log.info('PyPhi configuration:\n%s',
                     pyphi.config.get_config_string())

            start = time()
            pr = cProfile.Profile()
            pr.enable()

            results = tuple(pyphi.compute.complexes(network, state))

            pr.disable()
            end = time()

            pstatsfile = os.path.join(PSTATS, filename + '.pstats')
            os.makedirs(os.path.dirname(pstatsfile), exist_ok=True)
            pr.dump_stats(pstatsfile)

            log.info('Finished in %i seconds.', end - start)

            resultfile = os.path.join(RESULTS, filename + '-results.pkl')
            os.makedirs(os.path.dirname(resultfile), exist_ok=True)
            with open(resultfile, 'wb') as f:
                pickle.dump(results, f)
    except Exception as e:
        log.error(e)
        raise e