/*
add the varibale for dataset source file to backend
167379
public function extendBackendTemplate($strContent, $strTemplate)
    {
        if ($strTemplate == 'be_main')
        {
            $strScript = "<script>var advancedClassesSet = '".$GLOBALS['TL_CONFIG']['advancedClassesSet']."';var defaultColumnWidth = '".$GLOBALS['TL_CONFIG']['ac_defaultColumnWidth']."';</script>\n\r</body>";
            return str_replace('</body>', $strScript, $strContent);
        }
        return $strContent;
    }
240328
function(source){
    if (!source || (typeof source != 'object' && typeof source != 'function'))
    {
      /** @cut */ basis.dev.warn(this.constructor.className + '.addSource: value should be a dataset instance or to be able to resolve in dataset');
      return;
    }

    if (this.hasSource(source))
    {
      /** @cut */ basis.dev.warn(this.constructor.className + '.addSource: value is already in source list');
      return;
    }

    var sourceInfo = {
      owner: this,
      source: source,
      adapter: null,
      dataset: null
    };

    this.sourceValues_.push(sourceInfo);
    this.updateDataset_.call(sourceInfo, source);

    if (this.listen.sourceValue && source instanceof Emitter)
      source.addHandler(this.listen.sourceValue, this);
  }
1119300
def add_the_init(root_dir, data):
  """"""
  init_file = os.path.join(root_dir, '{dataset_type}', '__init__.py')
  context = (
      'from tensorflow_datasets.{dataset_type}.{dataset_name} import '
      '{dataset_cls}  # {TODO} Sort alphabetically\n'
  )
  with gfile.GFile(init_file.format(**data), 'a') as f:
    f.write(context.format(**data))
1163169
public void newDataSet(DataSetProviderType type,
                           RemoteCallback<DataSetDef> callback) throws Exception {
        dataSetDefServices.call(callback).createDataSetDef(type);
    }
1001868
private void addRecords(HBaseDataWrapper columnWrapper, List<HBaseDataWrapper> embeddableData,
            List<HBaseDataWrapper> dataSet)
    {
        dataSet.add(columnWrapper);

        if (!embeddableData.isEmpty())
        {
            dataSet.addAll(embeddableData);
        }
    }
367433
def addinputfile(project, filename, credentials=None): #pylint: disable=too-many-return-statements
        """"""

        printdebug('Addinputfile: Initialising' )

        user, oauth_access_token = parsecredentials(credentials) #pylint: disable=unused-variable
        response = Project.create(project, user)
        if response is not None:
            return response
        postdata = flask.request.values

        if filename == '': #pylint: disable=too-many-nested-blocks
            #Handle inputsource
            printdebug('Addinputfile: checking for input source' )
            if 'inputsource' in postdata and postdata['inputsource']:
                inputsource = None
                inputtemplate = None
                for profile in settings.PROFILES:
                    for t in profile.input:
                        for s in t.inputsources:
                            if s.id == postdata['inputsource']:
                                inputsource = s
                                inputsource.inputtemplate = t.id
                                inputtemplate = t
                                break
                if not inputsource:
                    for s in settings.INPUTSOURCES:
                        if s.id == postdata['inputsource']:
                            inputsource = s
                if not inputsource:
                    return withheaders(flask.make_response("No such inputsource exists",403),headers={'allow_origin': settings.ALLOW_ORIGIN})
                if not inputtemplate:
                    for profile in settings.PROFILES:
                        for t in profile.input:
                            if inputsource.inputtemplate == t.id:
                                inputtemplate = t
                if inputtemplate is None:
                    return withheaders(flask.make_response("No input template found for inputsource",500),headers={'allow_origin': settings.ALLOW_ORIGIN})
                if inputsource.isfile():
                    if inputtemplate.filename:
                        filename = inputtemplate.filename
                    else:
                        filename = os.path.basename(inputsource.path)
                    xml = addfile(project, filename, user, {'inputsource': postdata['inputsource'], 'inputtemplate': inputtemplate.id}, inputsource)
                    return xml
                elif inputsource.isdir():
                    if inputtemplate.filename:
                        filename = inputtemplate.filename
                    for f in glob.glob(inputsource.path + "/*"):
                        if not inputtemplate.filename:
                            filename = os.path.basename(f)
                        if f[0] != '.':
                            tmpinputsource = clam.common.data.InputSource(id='tmp',label='tmp',path=f, metadata=inputsource.metadata)
                            addfile(project, filename, user, {'inputsource':'tmp', 'inputtemplate': inputtemplate.id}, tmpinputsource)
                            #WARNING: Output is dropped silently here!
                    return "" #200
                else:
                    assert False
            else:
                return withheaders(flask.make_response("No filename or inputsource specified",403),headers={'allow_origin': settings.ALLOW_ORIGIN})
        else:
            #Simply forward to addfile
            return addfile(project,filename,user, postdata)
227394
function loadData (settings = {}, json = data) {
  const dataSet = new DataSet(json, settings)
  dataSet.processData()
  return dataSet
}
478396
function addVariable() {
            variableService.addOrUpdate(vm.variable, function () {
                vm.variables[vm.variable.key] = vm.variable.value;
                vm.variable = {
                    key: undefined,
                    value: undefined
                };
            });
        }
635240
def populateFromFile(self, dataUrl):
        
        self._dbFilePath = dataUrl
        self._db = SqliteRnaBackend(self._dbFilePath)
        self.addRnaQuants()
1246418
public MetadataBuilder addDataSource(@NotNull InputStream dataSource, String path, boolean closeAfterBuild) {
    checkHashingResultIsNotSet();
    filesPaths.add(path);
    dataSources.add(new StreamBasedHolderImpl(dataSource, closeAfterBuild));
    return this;
  }
118913
public void addDataSource(int groupno, DataSource datasource) {
    // the loader takes care of validation
    if (groupno == 0)
      datasources.add(datasource);
    else if (groupno == 1)
      group1.add(datasource);
    else if (groupno == 2)
      group2.add(datasource);
  }
517996
def set_file_system(self, source_url=False, build_url=False):
        """"""

        assert isinstance(source_url, string_types) or source_url is None or source_url is False
        assert isinstance(build_url, string_types) or build_url is False

        if source_url:
            self._source_url = source_url
            self.dataset.config.library.source.url = self._source_url
            self._source_fs = None

        elif source_url is None:
            self._source_url = None
            self.dataset.config.library.source.url = self._source_url
            self._source_fs = None

        if build_url:
            self._build_url = build_url
            self.dataset.config.library.build.url = self._build_url
            self._build_fs = None

        self.dataset.commit()
1224724
def _addDatasetAction(self, dataset):
        
        # create the toolbar action
        action = QAction(dataset.name(), self)
        action.setIcon(XColorIcon(dataset.color()))
        action.setCheckable(True)
        action.setChecked(True)
        action.setData(wrapVariant(dataset))
        action.toggled.connect(self.toggleDataset)
        
        self.uiDatasetTBAR.addAction(action)
546262
public void addBroadcastSet(String name, DataSet<?> data) {
		this.bcVars.add(new Tuple2<>(name, data));
	}
93223
public static void generateSource(String data, File sourceOutputPath) {
        ProtoFile protoFile = ProtoParser.parse(DEFAULT_FILE_NAME, data);
        List<CodeDependent> cds = new ArrayList<CodeDependent>();
        try {
            doCreate(protoFile, true, false, null, true, sourceOutputPath, cds, new HashMap<String, String>(), false);
        } catch (IOException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
635727
function getVariablesFromFile(file, data) {
    const regex = /(\$[\w-]*)\s*:\s*(.*);/g;
    let match = regex.exec(data);

    while (match) {

        /* check if variable is an background icon, if so replace it directly by the SVG */
        if (match[0].indexOf('../../images/backgrounds') >= 0) {

            const iconregex = /(\$[\w-]+)\s*:\s*"\.\.\/\.\.\/images\/backgrounds\/([\w./-]+)" !default;/g;
            const iconmatch = iconregex.exec(match[0]);
            let svg = fs.readFileSync(`src/images/backgrounds/${iconmatch[2]}`).toString();
            svg = `"${svg.replace(/\r?\n|\r/g, '%0A')
                .replace(/"/g, '\'')
                .replace(/\s/g, '%20')
                .replace(/</g, '%3C')
                .replace(/=/g, '%3D')
                .replace(/'/g, '%22')
                .replace(/:/g, '%3A')
                .replace(/\//g, '%2F')
                .replace(/>/g, '%3E')
                .replace(/%3Csvg/, 'data:image/svg+xml;charset=UTF-8,%3Csvg')}"`;

            /* add SVG to the coreVar and themeVar only if it is a theme file and make it optional */
            if (file.indexOf('theme/') < 0) {
                coreVar[iconmatch[1]] = {value: `${svg} !default;`, dependencies: []};
            }

            themeVar[iconmatch[1]] = {value: `${svg} !default;`, dependencies: []};

            /* add SVG to the variable within the file itself as well */
            const inlineSVG = `${iconmatch[1]}: ${svg} !default;`;
            data = data.replace(match[0], inlineSVG);

            /* when it is not an SVG add the variable and search for its dependencies */
        } else {

            const variablesRegex = /(\$[\w-]+)/g;
            let variablesMatch = variablesRegex.exec(match[2]);
            const dependencies = [];

            while (variablesMatch) {
                dependencies.push(variablesMatch[1]);
                variablesMatch = variablesRegex.exec(match[2]);
            }

            /* add variables only to the core Variables if it is not a theme file */
            if (file.indexOf('theme/') < 0) {
                coreVar[match[1]] = {value: `${match[2]};`, dependencies: Array.from(dependencies)};
            }

            themeVar[match[1]] = {value: `${match[2]};`, dependencies: Array.from(dependencies)};
        }

        match = regex.exec(data);
    }

    return data;
}
566591
function(config, options) {
      // Make sure config is initialised
      if( ! config ) {
        config = JSON.parse(JSON.stringify(self.defaults));
      }


      var datasetConfig = JSON.parse(JSON.stringify(config));
      var optionsIn = JSON.parse(JSON.stringify(options));
      for (var k in optionsIn) {
        datasetConfig[k] = optionsIn[k];
      }

      return datasetConfig;
    }