X_MSI_FEATURE and doc FileTag's can be used to collect files in a
        hierarchy. This function collects the files into this hierarchy.
554758
def create_feature_dict(files):
    
    dict = {}

    def add_to_dict( feature, file ):
        if not SCons.Util.is_List( feature ):
            feature = [ feature ]

        for f in feature:
            if f not in dict:
                dict[ f ] = [ file ]
            else:
                dict[ f ].append( file )

    for file in files:
        if hasattr( file, 'PACKAGING_X_MSI_FEATURE' ):
            add_to_dict(file.PACKAGING_X_MSI_FEATURE, file)
        elif hasattr( file, 'PACKAGING_DOC' ):
            add_to_dict( 'PACKAGING_DOC', file )
        else:
            add_to_dict( 'default', file )

    return dict
286126
function() {
				var doc = this;
				var stack = [];

				_.forEach(model.$oids, function(fkType, schemaPath) {
					if (fkType.type == 'subDocument') return; // Skip sub-documents (as they are stored against the parent anyway)

					stack = stack.concat(doc.getNodesBySchemaPath(schemaPath)
						.map(function(node) {
							node.fkType = fkType.type;
							return node;
						})
					);
				});
				return stack;
			}
525504
def tag(context: click.Context, file_id: int, tags: List[str]):
    """"""
    file_obj = context.obj['db'].file_(file_id)
    if file_obj is None:
        print(click.style('unable to find file', fg='red'))
        context.abort()
    for tag_name in tags:
        tag_obj = context.obj['db'].tag(tag_name)
        if tag_obj is None:
            tag_obj = context.obj['db'].new_tag(tag_name)
        elif tag_obj in file_obj.tags:
            print(click.style(f"{tag_name}: tag already added", fg='yellow'))
            continue
        file_obj.tags.append(tag_obj)
    context.obj['db'].commit()
    all_tags = (tag.name for tag in file_obj.tags)
    print(click.style(f"file tags: {', '.join(all_tags)}", fg='blue'))
907439
def list_tag(path = Dir.pwd)
      res = {}
      cg  = MiniGit::Capturing.new(path)
      unless (cg.tag :list => true).empty?
        # git show-ref --tags
        a = (cg.show_ref :tags => true).split("\n")
        res = Hash[ a.collect { |item| item.split(' refs/tags/') } ].invert
      end
      res
    end
370819
def search_tags(self, tags):
        
        qs = self.filter(tags__name__in=tags).order_by('file').distinct()
        return qs
1289582
def save(self, filething=None, **kwargs):
        

        if self.tags is not None:
            return self.tags.save(filething, **kwargs)
542280
private void collectFiles(final File folder, final List<File> found) {
		File[] files = folder.listFiles();
		if (files != null) {
			for (File file : files) {
				if (file.isDirectory()) {
					collectFiles(file, found);
				} else if (file.isFile() && file.getPath().endsWith(suffix)) {
					int index = 0;

					for (String text : plainTexts) {
						index = file.getPath().indexOf(text, index);
						if (index == -1) {
							break;
						} else {
							index += text.length();
						}
					}

					if (index >= 0) {
						found.add(file);
					}
				}
			}
		}
	}
809879
def collect(self):
        
        lxc_metrics = ["memory.usage_in_bytes", "memory.limit_in_bytes"]
        if os.path.isdir(self.config["sys_path"]) is False:
            self.log.debug("sys_path '%s' isn't directory.",
                           self.config["sys_path"])
            return {}

        collected = {}
        for item in os.listdir(self.config["sys_path"]):
            fpath = "%s/%s" % (self.config["sys_path"], item)
            if os.path.isdir(fpath) is False:
                continue

            for lxc_metric in lxc_metrics:
                filename = "%s/%s" % (fpath, lxc_metric)
                metric_name = "%s.%s" % (
                    item.replace(".", "_"),
                    lxc_metric.replace("_in_bytes", ""))
                self.log.debug("Trying to collect from %s", filename)
                collected[metric_name] = self._read_file(filename)

        for key in collected.keys():
            if collected[key] is None:
                continue

            for unit in self.config["byte_unit"]:
                value = diamond.convertor.binary.convert(
                    collected[key],
                    oldUnit="B",
                    newUnit=unit)
                new_key = "%s_in_%ss" % (key, unit)
                self.log.debug("Publishing '%s %s'", new_key, value)
                self.publish(new_key, value, metric_type="GAUGE")
356992
def _add_tag_file(zip_file, dir_name, tag_info_list, tag_tup):
    """"""
    tag_name, tag_str = tag_tup
    tag_path = d1_common.utils.filesystem.gen_safe_path(dir_name, tag_name)
    tag_iter = _create_and_add_tag_iter(zip_file, tag_path, tag_str)
    tag_info_list.append(
        {
            'path': tag_path,
            'checksum': d1_common.checksum.calculate_checksum_on_iterator(
                tag_iter, TAG_CHECKSUM_ALGO
            ),
        }
    )
1294975
private Collection<Node> collectPersistenceXml(final Archive<?> archive) {
        final Collection<Node> nodes = new LinkedList<Node>(getPersistenceDescriptors(archive));
        for (Node node : collectSubArchives(archive)) {
            if (node.getAsset() instanceof ArchiveAsset) {
                final ArchiveAsset archiveAsset = (ArchiveAsset) node.getAsset();
                nodes.addAll(collectPersistenceXml(archiveAsset.getArchive()));
            }
        }
        return nodes;
    }
4019
def _doc_parse(doc, module=None, qualname=None):
    

    # Build the rex
    known_tags = {
        'param': 'arg',
        'type': 'arg-type',
        'return': 'ret',
        'returns': 'ret',
        'rtype': 'ret-type',
        'exception': 'exc',
        'except': 'exc',
        'raise': 'exc',
        'raises': 'exc',
    }
    tag_rex = re.compile(r'^\s*:(' + '|'.join(map(re.escape, known_tags)) + r')\s*(\S+)?\s*:', re.MULTILINE)

    # Match tags
    collect_args = {}
    collect_ret = {}
    doc_args = []
    doc_exc = []
    for m in reversed(list(tag_rex.finditer(doc))):
        # Fetch data
        tag, arg = m.groups()
        tag = known_tags[tag]  # Normalized tag name

        # Fetch docstring part
        value = doc[m.end():].strip()  # Copy text after the tag
        doc = doc[:m.start()].strip()  # truncate the string

        # Handle tag: collect data
        if tag == 'exc':
            doc_exc.append(data.ExceptionDoc(arg, value))
        elif tag in ('ret', 'ret-type'):
            # Collect fields 1 by 1
            collect_ret[{'ret': 'doc', 'ret-type': 'type'}[tag]] = value
        elif tag in ('arg', 'arg-type'):
            # Init new collection
            if arg not in collect_args:
                doc_args.append(arg)  # add name for now, then map() replace with classes
                collect_args[arg] = {}
            # Collect fields 1 by 1
            collect_args[arg][{'arg': 'doc', 'arg-type': 'type'}[tag]] = value
        else:
            raise AssertionError('Unknown tag type: {}'.format(tag))

    # Merge collected data
    doc_ret = data.ValueDoc(**collect_ret) if collect_ret else None
    doc_args = map(lambda name: data.ArgumentDoc(name=name, **collect_args[name]), collect_args)

    # Finish
    return data.FDocstring(module=module, qualname=qualname, doc=doc, args=doc_args, exc=doc_exc, ret=doc_ret)
583136
function listAssets(book, pages) {
    var fs = book.getContentFS();

    var summary = book.getSummary();
    var summaryFile = summary.getFile().getPath();

    var glossary = book.getGlossary();
    var glossaryFile = glossary.getFile().getPath();

    var langs = book.getLanguages();
    var langsFile = langs.getFile().getPath();

    var config = book.getConfig();
    var configFile = config.getFile().getPath();

    function filterFile(file) {
        return !(
            file === summaryFile ||
            file === glossaryFile ||
            file === langsFile ||
            file === configFile ||
            book.isContentFileIgnored(file) ||
            pages.has(file)
        );
    }

    return timing.measure(
        'parse.listAssets',
        fs.listAllFiles('.', filterFile)
    );
}
1229066
def files(self, *, bundle: str=None, tags: List[str]=None, version: int=None,
              path: str=None) -> models.File:
        """"""
        query = self.File.query
        if bundle:
            query = (query.join(self.File.version, self.Version.bundle)
                          .filter(self.Bundle.name == bundle))

        if tags:
            # require records to match ALL tags
            query = (
                query.join(self.File.tags)
                .filter(self.Tag.name.in_(tags))
                .group_by(models.File.id)
                .having(func.count(models.Tag.name) == len(tags))
            )

        if version:
            query = query.join(self.File.version).filter(self.Version.id == version)

        if path:
            query = query.filter_by(path=path)

        return query
844737
def xmltreefromfile(filename):
    """"""
    try:
        return ElementTree.parse(filename, ElementTree.XMLParser(collect_ids=False))
    except TypeError:
        return ElementTree.parse(filename, ElementTree.XMLParser())
401024
function organizer(flat, tags, treeDescriptor, leafDescriptor) {
    var tree = {};
    flat.forEach(function (song) {
        var treePtr = tree;
        var depth = 1;

        // strPossibleKeys can be like "albumArtist|artist", or just "album" for instance
        treeDescriptor.forEach(function (strPossibleKeys) {
            var possibleKeys = strPossibleKeys.split("|");
            var valueForKey = undefined;
            for (var key in possibleKeys) {
                valueForKey = song[possibleKeys[key]];
                if (valueForKey !== undefined && valueForKey !== "") {
                    break;
                }
            }
            if (valueForKey === undefined) {
                valueForKey = "";
            }
            if (!treePtr[valueForKey]) {
                if (depth === treeDescriptor.length) {
                    treePtr[valueForKey] = { tags: {}, mpd: [] };
                } else {
                    treePtr[valueForKey] = { tags: {}, mpd: {} };
                }
                var mostCommonKey = possibleKeys[possibleKeys.length - 1];
                if (tags[mostCommonKey] && tags[mostCommonKey][valueForKey]) {
                    treePtr[valueForKey].tags = tags[mostCommonKey][valueForKey];
                }
            }
            treePtr = treePtr[valueForKey].mpd;
            depth++;
        });
        var leaf = {};
        if (leafDescriptor) {
            leafDescriptor.forEach(function (key) {
                leaf[key] = song[key];
            });
        } else {
            leaf = song;
        }
        if (tags["song"] && tags["song"][song.file]) {
            leaf.tags = tags["song"][song.file];
        }
        treePtr.push(leaf);
    });
    return { root: tree };
}
1047356
function collectResources(a, obj, tagName) {
        Array.prototype
            .forEach
            .call(a.ownerDocument.getElementsByTagName(tagName), function(r) {
                // Get canonical URL
                a.href = r.currentSrc || r.src || r.getAttribute("xlink:href") || r.href;

                // only get external resource
                if (a.href.match(/^https?:\/\//)) {
                    obj[a.href] = r;
                }
            });
    }
1063615
private void collectConfigs(GroupHierarchyConfig hierarchyConfig, List<CreateServerConfig> serverConfigs) {
        hierarchyConfig.getSubitems().stream().forEach(config -> {
            if (config instanceof ServerConfig) {
                serverConfigs.addAll(Arrays.asList(((ServerConfig)config).getServerConfig()));
            } else {
                collectConfigs((GroupHierarchyConfig) config, serverConfigs);
            }
        });
    }