Creates an experimental setup from a JSON file

        Parameters
        ----------
        filename : str
            Absolute path to JSON file

        Returns
        -------
        caspo.core.setup.Setup
            Created object instance
500161
def from_json(cls, filename):
        
        with open(filename) as fp:
            raw = json.load(fp)

        return cls(raw['stimuli'], raw['inhibitors'], raw['readouts'])
490230
def from_python_src(
        cls,
        pySrc,
        lambdas_path,
        json_filename: str,
        stem: str,
        save_file: bool = False,
    ):
        """"""
        asts = [ast.parse(pySrc)]
        pgm_dict = genPGM.create_pgm_dict(
            lambdas_path,
            asts,
            json_filename,
            {"FileName": f"{stem}.py"},  # HACK
        )
        lambdas = importlib.__import__(stem + "_lambdas")
        return cls.from_dict(pgm_dict, lambdas)
1129974
def save(self, filename):
        ''' 
        '''
        with open(filename, 'w') as outfile:
            json.dump(self.to_json(), outfile)
897781
def from_json(cls, path, fatal=True, logger=None):
        
        result = cls()
        result.load(path, fatal=fatal, logger=logger)
        return result
528482
def load_data_file_to_net(self, filename):
    '''
    
    '''
    inst_dat = self.load_json_to_dict(filename)
    load_data.load_data_to_net(self, inst_dat)
486418
public static function fromFilename($filename)
    {
        $contents = file_get_contents($filename);
        $jsonData = json_decode($contents, true);
        $instance = new self($jsonData);
        return $instance;
    }
714298
def load(self, filename):
        
        if filename is None:
            filename = LOCALCONFIG
        with open(filename, 'r') as fid:
            self._conf.update(json.load(fid))
        self.add_history('Updated from config file: %s' % filename)
1155853
def read_settings(filename=None, defs=None):
    
    # READ SETTINGS
    defs = listwrap(defs)
    defs.append({
        "name": ["--config", "--settings", "--settings-file", "--settings_file"],
        "help": "path to JSON file with settings",
        "type": str,
        "dest": "filename",
        "default": None,
        "required": False
    })
    args = argparse(defs)

    args.filename = coalesce(filename, args.filename, "./config.json")
    settings_file = File(args.filename)
    if not settings_file.exists:
        Log.error("Can not read configuration file {{filename}}", {
            "filename": settings_file.abspath
        })
    settings = mo_json_config.get_file(settings_file)
    settings.args = args
    return settings
21441
def get_json_schema(filename):
    
    file_path = os.path.join("schemas", filename)
    with open(file_path) as f:
        schema = yaml.load(f)
    return schema
731081
def _build_filename_from_browserstack_json(j):
    
    filename = ''
    device = j['device'] if j['device'] else 'Desktop'
    if j['state'] == 'done' and j['image_url']:
        detail = [device, j['os'], j['os_version'],
                  j['browser'], j['browser_version'], '.jpg']
        filename = '_'.join(item.replace(" ", "_") for item in detail if item)
    else:
        print 'screenshot timed out, ignoring this result'
    return filename
742528
function fileScope(filename) {
    filename = path.resolve('', filename || '');
    var result = scopes[filename];
    if (!result) {
      result = create({
        clean: clean,
        removeList: removeList,
        excludeList: excludeList,
        rootScope: rootScope,
        filename: filename,
        argv: argv,
        scopes: scopes,
        processors: processors,
        variants: variants,
        cacheKeys: cacheKeys,
        tags: tags
      });
    }
    return result;
  }
870184
def open_json(file_name):
    
    with open(file_name, "r") as json_data:
        data = json.load(json_data)
        return data
1311759
def load(cls, fname, args):
    

    if args.type == JSON:
        if fname.endswith('.bz2'):
            open_ = bz2.open
        else:
            open_ = open

        if args.progress:
            print('Loading JSON data...')

        with open_(fname, 'rt') as fp:
            storage = JsonStorage.load(fp)
    else:
        storage = SqliteStorage.load(fname)

    if args.settings is not None:
        extend(storage.settings, args.settings)

    return cls.from_storage(storage)
672050
def _setup_py_run_from_dir(root_dir, py_interpreter):
    """"""
    data = {}
    with _enter_single_subdir(root_dir) as single_subdir:
        if not os.path.exists("setup.py"):
            raise Exception("'setup.py' does not exist in '%s'" % (
                single_subdir))
        # generate a temporary json file which contains the metadata
        output_json = tempfile.NamedTemporaryFile()
        cmd = "%s setup.py -q --command-packages metaextract " \
              "metaextract -o %s " % (py_interpreter, output_json.name)
        try:
            subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
        except subprocess.CalledProcessError:
            # try again with a encoding in setup.py
            _set_file_encoding_utf8("setup.py")
            subprocess.check_output(cmd, shell=True)

        # read json file and return data
        with open(output_json.name, "r") as f:
            data = json.loads(f.read())

        # sort some of the keys if the dict values are lists
        for key in ['data_files', 'entry_points', 'extras_require',
                    'install_requires', 'setup_requires', 'scripts',
                    'tests_require', 'tests_suite']:
            if key in data['data'] and isinstance(data['data'][key], list):
                data['data'][key] = sorted(data['data'][key])
    return data
191680
def loadFromFile(fileName):
        
        assert os.path.exists(fileName), "File " + fileName + " does not exist"
        conf = json.load(open(fileName))
        return ReturnInfo(
            articleInfo=ArticleInfoFlags(**conf.get("articleInfo", {})),
            eventInfo=EventInfoFlags(**conf.get("eventInfo", {})),
            sourceInfo=SourceInfoFlags(**conf.get("sourceInfo", {})),
            categoryInfo=CategoryInfoFlags(**conf.get("categoryInfo", {})),
            conceptInfo=ConceptInfoFlags(**conf.get("conceptInfo", {})),
            locationInfo=LocationInfoFlags(**conf.get("locationInfo", {})),
            storyInfo=StoryInfoFlags(**conf.get("storyInfo", {})),
            conceptClassInfo=ConceptClassInfoFlags(**conf.get("conceptClassInfo", {})),
            conceptFolderInfo=ConceptFolderInfoFlags(**conf.get("conceptFolderInfo", {}))
        )
314104
def from_file(cls, f):
        

        with open_file_like(f, 'r') as fp:
            return cls(json.load(fp))
736122
def _schema_from_json_file_object(self, file_obj):
        
        json_data = json.load(file_obj)
        return [SchemaField.from_api_repr(field) for field in json_data]