Loads a DataFrame with all the needed info about the run
        (JSON file)
19792
def load_info_df(self, file_name=None):
        """"""

        if file_name is None:
            file_name = self.info_file

        with open(file_name, 'r') as infile:
            top_level_dict = json.load(infile)

        new_info_df_dict = top_level_dict['info_df']
        new_info_df = pd.DataFrame(new_info_df_dict)
        self.info_df = new_info_df

        self._prm_packer(top_level_dict['metadata'])
        self.info_file = file_name
        logger.debug("loaded info_df")
        logger.debug(" info_file: %s" % self.info_file)
328711
def load_input():
    
    file = open(_input_file, 'r')
    result = json.loads(file.read().strip('\0').strip())
    file.close()
    return result
1310734
def load_config(json_path):
  """"""
  with open(json_path, 'r') as json_file:
    config = json.loads(json_file.read())
  # sanity-test the config:
  assert(config['tree'][0]['page'] == 'index')
  return config
233829
def load_json(filename: str) -> Union[List, Dict]:
    
    try:
        with open(filename, encoding='utf-8') as fdesc:
            return json.loads(fdesc.read())
    except FileNotFoundError:
        # This is not a fatal error
        _LOGGER.debug('JSON file not found: %s', filename)
    except ValueError as error:
        _LOGGER.exception('Could not parse JSON content: %s', filename)
        raise PytradfriError(error)
    except OSError as error:
        _LOGGER.exception('JSON file reading failed: %s', filename)
        raise PytradfriError(error)
    return {}
10696
def import_json(path, model, batch_len=100, db_alias='default', start_batch=0, end_batch=None, ignore_errors=False, verbosity=2):
    """"""

    # TODO: use a generator to save memory for large json files/databases
    if verbosity > 0:
        print('Reading json records (dictionaries) from {0}.'.format(repr(path)))
    item_list = json.load(open(path, 'r'))
    if verbosity > 0:
        print('Finished reading {0} items from {1}.'.format(len(item_list), repr(path)))
    import_items(item_list, model=model, batch_len=batch_len, db_alias=db_alias, start_batch=start_batch, end_batch=end_batch, ignore_errors=ignore_errors, verbosity=verbosity)
1122469
def convert_runsummary_to_json(
        df, comment='Uploaded via km3pipe.StreamDS', prefix='TEST_'
):
    """"""
    data_field = []
    comment += ", by {}".format(getpass.getuser())
    for det_id, det_data in df.groupby('det_id'):
        runs_field = []
        data_field.append({"DetectorId": det_id, "Runs": runs_field})

        for run, run_data in det_data.groupby('run'):
            parameters_field = []
            runs_field.append({
                "Run": int(run),
                "Parameters": parameters_field
            })

            parameter_dict = {}
            for row in run_data.itertuples():
                for parameter_name in run_data.columns:
                    if parameter_name in REQUIRED_COLUMNS:
                        continue

                    if parameter_name not in parameter_dict:
                        entry = {'Name': prefix + parameter_name, 'Data': []}
                        parameter_dict[parameter_name] = entry
                    data_value = getattr(row, parameter_name)
                    try:
                        data_value = float(data_value)
                    except ValueError as e:
                        log.critical("Data values has to be floats!")
                        raise ValueError(e)
                    value = {'S': str(getattr(row, 'source')), 'D': data_value}
                    parameter_dict[parameter_name]['Data'].append(value)
            for parameter_data in parameter_dict.values():
                parameters_field.append(parameter_data)
    data_to_upload = {"Comment": comment, "Data": data_field}
    file_data_to_upload = json.dumps(data_to_upload)
    return file_data_to_upload
968934
def load_data(verbose=False):
    ""

    df = pd.read_csv(STOPS_PATH, usecols=['stop_id', 'stop_name'])
    if verbose:
        print('- Loaded %d entries from "%s".' % (len(df), STOPS_PATH))
    return df
779865
def _load_db():
    """"""
    from os import path
    from pyci.utility import get_json
    global datapath, db
    datapath = path.abspath(path.expanduser(settings.datafile))
    vms("Deserializing DB from {}".format(datapath))
    db = get_json(datapath, {"installed": [], "enabled": True, "cron": False})
1372566
function _loadJSON(file) {
  try {
    var data = _fs2.default.readFileSync(file);
  } catch (e) {
    throw new Error(file + " expected to be in JSON format");
  }
  return JSON.parse(data);
}
846872
def load_existing_json():
        
        dir = logger.get_logger_dir()
        fname = os.path.join(dir, JSONWriter.FILENAME)
        if tf.gfile.Exists(fname):
            with open(fname) as f:
                stats = json.load(f)
                assert isinstance(stats, list), type(stats)
                return stats
        return None
484616
def load_from_json(file_path):
    """"""
    if os.path.exists(file_path):
        raw_data = open(file_path, 'rb').read()
        return json.loads(base64.decodestring(raw_data).decode('utf-8'))
1138775
def get_run_details_json(self):
        
        run_details_filename = "run_details.json"
        run_details_json_id = dxpy.find_one_data_object(more_ok=False,zero_ok=True,project=self.dx_project_id,name=run_details_filename)["id"]
        json_data = json.loads(dxpy.open_dxfile(dxid=run_details_json_id).read())
        #dxpy.download_dxfile(show_progress=True,dxid=run_details_json_id,project=self.dx_project_id,filename=output_name)
        return json_data
128591
def save_info_df(self):
        """"""
        logger.debug("running save_info_df")

        info_df = self.info_df
        top_level_dict = {'info_df': info_df, 'metadata': self._prm_packer()}

        # packing prms

        jason_string = json.dumps(top_level_dict,
                                  default=lambda info_df: json.loads(
                                      info_df.to_json()))
        with open(self.info_file, 'w') as outfile:
            outfile.write(jason_string)
        logger.info("Saved file to {}".format(self.info_file))
440033
def load_db(self):
        
        try:
            with open(self.json_db_path) as fp:
                self.db = json.load(fp)
        except Exception as e:
            _logger.debug("*** Open JSON DB error.")
            raise e
688899
def load_json_dict(filename, *args):
	""""""
	data = {}
	if os.path.exists(filename):
		with open(filename, "r") as f:
			try:
				data = json.load(f)
				if not isinstance(data, dict):
					data = {}
			except:
				pass 
		if args:
			return {key: data[key] for key in args if key in data}
	return data
856057
def load_data(fpath, **kwargs):
    
    ext = splitext(fpath)[1]
    if ext in ['.pickle', '.cPkl', '.pkl']:
        return load_cPkl(fpath, **kwargs)
    elif ext in ['.json']:
        return load_json(fpath, **kwargs)
    elif ext in ['.hdf5']:
        return load_hdf5(fpath, **kwargs)
    elif ext in ['.txt']:
        return load_text(fpath, **kwargs)
    elif HAS_NUMPY and ext in ['.npz', '.npy']:
        return load_numpy(fpath, **kwargs)
    else:
        assert False, 'unknown ext=%r for fpath=%r' % (ext, fpath)
484079
def load_heroes():
    

    filename = os.path.join(os.path.dirname(__file__), "data", "heroes.json")

    with open(filename) as f:
        heroes = json.loads(f.read())["result"]["heroes"]
        for hero in heroes:
            HEROES_CACHE[hero["id"]] = hero