Multiple components per file should be allowed
769937
function AnotherBasicComponent(props: { name: string }): React.Node {
    return <div>Bonjour {props.name}!</div>;
}
763350
function guessBestFile(componentName, files) {
			var minDist = 1e13;
			var minDistIndex = -1;

			files.sort(function(a, b) {
				// Reverse order by path length
				return b.length - a.length;
			});

			files.forEach(function(filepath, i) {
				var filename = path.basename(filepath, '.js');
				var dist = _.str.levenshtein(componentName, filename);
				if (dist <= minDist) {
					minDist = dist;
					minDistIndex = i;
				}
			});

			if (minDistIndex !== -1) {
				return files[minDistIndex];
			}
			else {
				return undefined;
			}
		}
1274341
private void initComponents(List<CmsSetupComponent> components) {

        for (CmsSetupComponent component : components) {
            CheckBox checkbox = new CheckBox();
            checkbox.setValue(component.isChecked());
            checkbox.setCaption(component.getName() + " - " + component.getDescription());
            checkbox.setDescription(component.getDescription());
            checkbox.setData(component);
            checkbox.setWidth("100%");
            m_components.addComponent(checkbox);
            m_componentCheckboxes.add(checkbox);
            m_componentMap.put(component.getId(), component);

        }
    }
963214
private void setComponents() {

        CmsUriSplitter splitter = new CmsUriSplitter(m_uri, true);
        m_target = splitter.getPrefix();
        m_anchor = CmsLinkProcessor.unescapeLink(splitter.getAnchor());
        setQuery(splitter.getQuery());
    }
338972
function setFilesets(path, done) {
    var config = JSON.parse(fs.readFileSync(path, 'utf8'));

    /* jshint sub: true */
    var includeFiles = config['includeFiles'];
    var excludeFiles = config['excludeFiles'];
    var filterFiles = config['lintOnly'];
    /* jshint sub: false */

    if (filterFiles && !Array.isArray(filterFiles)) {
        filterFiles = [];
        console.log(chalk.yellow('invalid `lintOnly` set; ignoring'));
    }

    if (includeFiles && Array.isArray(includeFiles)) {
        filesets.include(includeFiles, filterFiles);
    } else {
        console.log(chalk.yellow('valid `includeFiles` not found in %s'), path);
    }

    if (excludeFiles && Array.isArray(includeFiles)) {
        filesets.exclude(excludeFiles);
    } else {
        console.log(chalk.yellow('valid `excludeFiles` not found in %s'), path);
    }

    done();
}
380142
def build_components(components):
    
    component_list = []

    for comp in components:
        component = ea.Component()

        # id
        component.id = comp.get('id')

        # type
        component.type = comp.get('type')

        # asset, if available
        component.asset = comp.get('asset')

        # DOI
        component.doi = comp.get('doi')

        if component_title(comp) != '':
            component.title = component_title(comp)

        # Subtitle
        if comp.get('type') in ['supplementary-material', 'fig']:

            if comp.get('full_caption'):
                subtitle = comp.get('full_caption')
                subtitle = clean_abstract(subtitle)
                component.subtitle = subtitle

        # Mime type
        if comp.get('type') in ['abstract', 'table-wrap', 'sub-article',
                                'chem-struct-wrap', 'boxed-text']:
            component.mime_type = 'text/plain'
        if comp.get('type') in ['fig']:
            component.mime_type = 'image/tiff'
        elif comp.get('type') in ['media', 'supplementary-material']:
            if comp.get('mimetype') and comp.get('mime-subtype'):
                component.mime_type = (comp.get('mimetype') + '/'
                                       + comp.get('mime-subtype'))

        # Permissions
        component.permissions = comp.get('permissions')

        # Append it to our list of components
        component_list.append(component)

    return component_list
629371
function _makeFileMostRecent(paneId, file) {
        var index,
            entry,
            pane = _getPane(paneId);

        if (!_traversingFileList) {
            pane.makeViewMostRecent(file);

            index = _findFileInMRUList(pane.id, file);

            entry = _makeMRUListEntry(file, pane.id);

            if (index !== -1) {
                _mruList.splice(index, 1);
            }

            if (_findFileInMRUList(pane.id, file) !== -1) {
                console.log(file.fullPath + " duplicated in mru list");
            }

            // add it to the front of the list
            _mruList.unshift(entry);
        }
    }
168344
function fixDemoComponentHtml(component, folder) {
    var re = /<!-- ignore the following lines[\s\S]*<!-- start to learn the demo from here -->\r?\n/;
    component.code = component.code.replace(re, '');

    if (component.code.indexOf('jigsaw-demo-description') != -1) {
        console.error('ERROR: can not strip "jigsaw-demo-description" from html!');
        console.error(`       path=${folder}`);
        process.exit(1);
    }
}
1100279
function loadComponentFile (meta, key, filepath, messages) {
  const ext = path.extname(filepath).slice(1)
  const loader = fileLoaders[ext] || fileLoaders.DEFAULT

  return loader(meta, key, filepath, messages)
}
312897
def component(self, *components):
        
        """
        for component in components:
            self._component.append(component)
        return self
989579
def split_candidates(candsfile, featind1, featind2, candsfile1, candsfile2):
    

    with open(candsfile, 'rb') as pkl:
        d = pickle.load(pkl)
        cands = pickle.load(pkl)

    features = d['features']
    d1 = d.copy()
    d2 = d.copy()
    d1['features'] = [features[i] for i in featind1]
    d2['features'] = [features[i] for i in featind2]

    cands1 = {}
    cands2 = {}
    for key in cands:
        cands1[key] = tuple([cands[key][i] for i in featind1])
        cands2[key] = tuple([cands[key][i] for i in featind2])

    with open(candsfile1, 'w') as pkl:
        pickle.dump(d1, pkl, protocol=2)
        pickle.dump(cands1, pkl, protocol=2)

    with open(candsfile2, 'w') as pkl:
        pickle.dump(d2, pkl, protocol=2)
        pickle.dump(cands2, pkl, protocol=2)
447434
def updateComponentStartVals(self):
        """"""
        for param in self._parameters:
            for component in param['selection']:
                if param['parameter'] == 'filename':
                    component.set(param['parameter'], param['names'][0])
                else:
                    component.set(param['parameter'], param['start'])
571808
function generateClosuredComponents() {
    const componentsDir = './src/components';

    // Cleanup
    childProcess.execSync(`rm -rf ${componentsDir}`);

    // Generate
    fs.mkdirSync(componentsDir);
    LIST.forEach(name => {
        const componentSrcPath = `./node_modules/prismjs/components/prism-${name}.js`;
        const componentSrc = fs.readFileSync(componentSrcPath);
        const moduleSrc = moduleExport(prismClosure(componentSrc));
        const outputPath = path.join(componentsDir, `prism-${name}.js`);
        fs.writeFileSync(outputPath, moduleSrc);
    });
}
1279280
function initComponentDir (config, absDir, file) {
    // get name from camel-case file
    var name = changeCase.camelCase(file)
    // map of files in directory
    var files = {}
    // read all files
    _.each(fs.readdirSync(absDir), file => {
        files[file] = false
    })
    // component specification
    var component = {name: name}
    // map of files to be required and the property they map to
    var requireFiles = {
        [`${file}.client.js`]: 'client',
        [`${file}.server.js`]: 'server',
    }
    // require files
    _.each(requireFiles, (property, file) => {
        // skip if file does not exist
        if (!defined(files[file])) {
            return
        }
        // require file and set as property for component
        component[property] = require(
            path.relative(__dirname, `${absDir}/${file}`)
        )
        // set flag true once file read
        files[file] = true
    })
    // map of files to load and the property they map to
    var loadFiles = {
        [`${file}.css`]: 'css',
        [`${file}.hbs`]: 'template',
        [`${file}.js`]: 'js',
    }
    // load files
    _.each(loadFiles, (property, file) => {
        // skip if file does not exist
        if (!defined(files[file])) {
            return
        }
        // require file and set as property for component
        component[property] = fs.readFileSync(`${absDir}/${file}`, {
            encoding: 'utf8'
        })
        // set flag true once file read
        files[file] = true
    })
    // load partials if directory exists
    if (defined(files['partials'])) {
        // create partials entry in config
        component.partials = {}
        // get abs path of partials dir
        var partialsDir = `${absDir}/partials`
        // load each file in partials dir
        _.each(fs.readdirSync(partialsDir), file => {
            // get absolute path of file
            var absFile = `${partialsDir}/${file}`
            // partial must have hbs extension
            if (file.match(/\.hbs$/)) {
                // use file name for partial name
                var name = changeCase.camelCase(file.replace(/\.hbs$/, ''))
                // load file
                component.partials[name] = fs.readFileSync(absFile, {
                    encoding: 'utf8'
                })
            }
            else {
                debug('initComponentDir: ignoring %s', absFile)
            }
        })
        // set flag true once file read
        files['partials'] = true
    }
    // load helpers if directory exists
    if (defined(files['helpers'])) {
        // create helpers entry in config
        component.helpers = {}
        // get abs path of helpers dir
        var helpersDir = `${absDir}/helpers`
        // load each file in partials dir
        _.each(fs.readdirSync(helpersDir), file => {
            // get absolute path of file
            var absFile = `${helpersDir}/${file}`
            // helpers must have hbs extension
            if (file.match(/\.js$/)) {
                // require file
                var helper = require(path.relative(__dirname, absFile))
                // helper is single function
                if (typeof helper === 'function') {
                    // use file name for helper name
                    var name = changeCase.camelCase(file.replace(/\.hbs$/, ''))
                    // set helper for component
                    component.helpers[name] = helper
                }
                // otherwise helper should be object keyed by name
                else {
                    _.merge(component.helpers, helper)
                }
            }
            else {
                debug('initComponentDir: ignoring %s', absFile)
            }
        })
        // set flag true once file read
        files['helpers'] = true
    }
    // if component is already defined merge this data over original spec
    if (defined(config.components[name])) {
        _.merge(config.components[name], component)
    }
    // otherwise defined new component
    else {
        config.components[name] = component
    }
}
491445
def open_multi(cls, sock, chunk_types, isattys, chunk_eof_type=None, buf_size=None,
                 select_timeout=None):
    """"""
    cls._assert_aligned(chunk_types, isattys)

    # N.B. This is purely to permit safe handling of a dynamic number of contextmanagers.
    with ExitStack() as stack:
      read_fds, write_fds = list(zip(
        # Allocate one pipe pair per chunk type provided.
        *(stack.enter_context(_pipe(isatty)) for isatty in isattys)
      ))
      writer = NailgunStreamWriter(
        read_fds,
        sock,
        chunk_types,
        chunk_eof_type,
        buf_size=buf_size,
        select_timeout=select_timeout
      )
      with writer.running():
        yield write_fds, writer
727527
function normalizeComponents (options) {
	  if (options.components) {
	    var components = options.components;
	    var def;
	    for (var key in components) {
	      var lower = key.toLowerCase();
	      if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
	        "development" !== 'production' && warn(
	          'Do not use built-in or reserved HTML elements as component ' +
	          'id: ' + key
	        );
	        continue
	      }
	      def = components[key];
	      if (isPlainObject(def)) {
	        components[key] = Vue$3.extend(def);
	      }
	    }
	  }
	}
49334
def filter_components_by_name(name, components_list, type_=T_RPM):
    """"""
    for components in components_list:
        for component in components:
            if component['type'] == type_ and component['name'] == name:
                yield component