:param taxonomies: a set of taxonomies
        :returns: a new CompositeRiskModel reduced to the given taxonomies
519383
def reduce(self, taxonomies):
        
        new = copy.copy(self)
        new.taxonomies = sorted(taxonomies)
        new._riskmodels = {}
        for riskid, rm in self._riskmodels.items():
            if riskid in taxonomies:
                new._riskmodels[riskid] = rm
                rm.compositemodel = new
        return new
463956
def _flatten_subclass_tree(cls):
    
    subclasses = frozenset(cls.__subclasses__())
    children = frozenset(toolz.concat(map(_flatten_subclass_tree, subclasses)))
    return frozenset({cls}) | subclasses | children
473071
def compact(self, term_doc_matrix):
		'''
		
		'''
		domain_mat = CombineDocsIntoDomains(term_doc_matrix).get_new_term_doc_mat(self.doc_domains)
		domain_count = (domain_mat > 0).sum(axis=0)
		valid_term_mask = (self.max_domain_count >= domain_count) \
		                  & (domain_count >= self.min_domain_count)
		indices_to_compact = np.arange(term_doc_matrix.get_num_terms())[~valid_term_mask.A1]
		return term_doc_matrix.remove_terms_by_indices(indices_to_compact)
405712
def start(self, children):
        

        composites = []

        for composite_dict in children:
            if False and self.include_position:
                key_token = composite_dict[1]
                key_name = key_token.value.lower()
                composites_position = self.get_position_dict(composite_dict)
                composites_position[key_name] = self.create_position_dict(key_token, None)

            composites.append(composite_dict)

        # only return a list when there are multiple root composites (e.g.
        # several CLASSes)
        if len(composites) == 1:
            return composites[0]
        else:
            return composites
1296811
function ( relationships, deformerNodes ) {

			var rawBones = [];

			relationships.children.forEach( function ( child ) {

				var boneNode = deformerNodes[ child.ID ];

				if ( boneNode.attrType !== 'Cluster' ) return;

				var rawBone = {

					ID: child.ID,
					indices: [],
					weights: [],
					transform: new THREE.Matrix4().fromArray( boneNode.Transform.a ),
					transformLink: new THREE.Matrix4().fromArray( boneNode.TransformLink.a ),
					linkMode: boneNode.Mode,

				};

				if ( 'Indexes' in boneNode ) {

					rawBone.indices = boneNode.Indexes.a;
					rawBone.weights = boneNode.Weights.a;

				}

				rawBones.push( rawBone );

			} );

			return {

				rawBones: rawBones,
				bones: []

			};

		}
1078276
def drop_neutral_categories_from_corpus(self):
		'''
		
		'''
		neutral_categories = self._get_neutral_categories()
		self.term_doc_mat = self.term_doc_mat.remove_categories(neutral_categories)
		self._reindex_priors()
		return self
854964
def mfds2multimfd(mfds):
    
    _, kind = mfds[0].tag.split('}')
    node = Node('multiMFD', dict(kind=kind, size=len(mfds)))
    lengths = None
    for field in mfd.multi_mfd.ASSOC[kind][1:]:
        alias = mfd.multi_mfd.ALIAS.get(field, field)
        if field in ('magnitudes', 'occurRates'):
            data = [~getattr(m, field) for m in mfds]
            lengths = [len(d) for d in data]
            data = sum(data, [])  # list of lists
        else:
            try:
                data = [m[alias] for m in mfds]
            except KeyError:
                if alias == 'binWidth':
                    # missing bindWidth in GR MDFs is ok
                    continue
                else:
                    raise
        node.append(Node(field, text=collapse(data)))
        if lengths:  # this is the last field if present
            node.append(Node('lengths', text=collapse(lengths)))
    return node
824961
def ontologyConceptTree(self):
        
        treedict = {}
        if self.all_skos_concepts:
            treedict[0] = self.toplayer_skos
            for element in self.all_skos_concepts:
                if element.children():
                    treedict[element] = element.children()
            return treedict
        return treedict
1065940
private NodeSet<OWLClass> nodesToOwlClassNodeSet(Set<au.csiro.ontology.Node> nodes) {
        Set<Node<OWLClass>> temp = new HashSet<Node<OWLClass>>();
        for (au.csiro.ontology.Node n : nodes) {
            temp.add(nodeToOwlClassNode(n));
        }
        return new OWLClassNodeSet(temp);
    }
58609
private function empty_taxonomies() {
		global $wpdb;

		// Empty taxonomies and terms
		$terms      = $wpdb->get_results( "SELECT term_id, taxonomy FROM $wpdb->term_taxonomy" );
		$taxonomies = [];
		foreach ( (array) $terms as $term ) {
			$taxonomies[] = $term->taxonomy;
			wp_cache_delete( $term->term_id, $term->taxonomy );
		}

		$taxonomies = array_unique( $taxonomies );
		$cleaned    = [];
		foreach ( $taxonomies as $taxonomy ) {
			if ( isset( $cleaned[ $taxonomy ] ) ) {
				continue;
			}
			$cleaned[ $taxonomy ] = true;

			wp_cache_delete( 'all_ids', $taxonomy );
			wp_cache_delete( 'get', $taxonomy );
			delete_option( "{$taxonomy}_children" );
		}
		$wpdb->query( "TRUNCATE $wpdb->terms" );
		$wpdb->query( "TRUNCATE $wpdb->term_taxonomy" );
		$wpdb->query( "TRUNCATE $wpdb->term_relationships" );
		if ( ! empty( $wpdb->termmeta ) ) {
			$wpdb->query( "TRUNCATE $wpdb->termmeta" );
		}
	}
1281951
def create_from_name_and_dictionary(self, name, datas):
        
        category = ObjectCategory(name)
        self.set_common_datas(category, name, datas)

        if "order" in datas:
            category.order = int(datas["order"])

        return category
1065724
public final ImmutableList<TaxonomyTerm> categories() {
      ImmutableList<TaxonomyTerm> categories = taxonomyTerms.get(CATEGORY_TAXONOMY);
      return categories != null ? categories : ImmutableList.of();
   }
1053684
def _combined_grouping_values(grouping_name,collection_a,collection_b):
    
    new_grouping= collection_a.groupings.get(grouping_name,{}).copy()
    new_grouping.update(collection_b.groupings.get(grouping_name,{}))
    return new_grouping
863624
def reduce_contexts(parent, local):

  """"""

  context = {}

  for k,v in parent.items():
    if type(v) == dict:
      d = v.copy()
      d.update(local.get(k,{}))
      context[k] = d
    elif type(v) == list:
      context[k] = v + ensure_list(local.get(k,[]))
    else:
      context[k] = local.get(k,v)

  for k in set(local.keys()) - set(parent.keys()):
    context[k] = local[k]

  return context
566784
def types_of_specie(self):
        
        if not self.is_ordered:
            raise TypeError("""\
types_of_species cannot be used with disordered structures and partial occupancies.
Use OrderDisorderedStructureTransformation or EnumerateStructureTransformation
to build an appropriate supercell from partial occupancies.""")

        # Cannot use set since we want a deterministic algorithm.
        types = []
        for site in self:
            if site.specie not in types:
                types.append(site.specie)
        return types
641054
def ontologyPropTree(self):
        
        treedict = {}
        if self.all_properties:
            treedict[0] = self.toplayer_properties
            for element in self.all_properties:
                if element.children():
                    treedict[element] = element.children()
            return treedict
        return treedict
1319983
def use_all_categories(self):
		'''
		
		'''
		term_df = self.term_ranker.get_ranks()
		self.priors += term_df.sum(axis=1).fillna(0.)
		return self