Reindex the Analysis Request the analysis belongs to, as well as the
    ancestors recursively
189644
def reindex_request(analysis, idxs=None):
    
    if not IRequestAnalysis.providedBy(analysis) or \
            IDuplicateAnalysis.providedBy(analysis):
        # Analysis not directly bound to an Analysis Request. Do nothing
        return

    n_idxs = ['assigned_state', 'getDueDate']
    n_idxs = idxs and list(set(idxs + n_idxs)) or n_idxs
    request = analysis.getRequest()
    ancestors = [request] + request.getAncestors(all_ancestors=True)
    for ancestor in ancestors:
        push_reindex_to_actions_pool(ancestor, n_idxs)
1178410
def reindex_submitted_analyses(portal):
    
    logger.info("")
    brains = api.search({}, "bika_analysis_catalog")

    total = len(brains)
    logger.info("Processing {} analyses".format(total))

    for num, brain in enumerate(brains):
        # skip analyses which have an analyst
        if brain.getAnalyst:
            continue
        # reindex analyses which have no annalyst set, but a result
        if brain.getResult not in ["", None]:
            analysis = brain.getObject()
            analysis.reindexObject()
        if num > 0 and num % 5000 == 0:
            logger.info("Commiting reindexed analyses {}/{} ..."
                        .format(num, total))
            transaction.commit()
752867
def analysis(self):
        
        if self._analysis is not None:
            return self._analysis

        if self.cache_dir is not None:
            path = os.path.join(self.cache_dir, self.checksum)
            try:
                if self.refresh_cache: raise IOError
                with open(path + '.pickle', 'rb') as pickle_file:
                    self._analysis = pickle.load(pickle_file)
            except IOError:
                self._analysis = librosa_analysis.analyze_frames(self.all_as_mono(), self.samplerate)
                with open(path + '.pickle', 'wb') as pickle_file:
                    pickle.dump(self._analysis, pickle_file, pickle.HIGHEST_PROTOCOL)
        else:
            self._analysis = librosa_analysis.analyze_frames(self.all_as_mono(), self.samplerate)
        return self._analysis
164022
def _recursive_reindex_object_security(self, obj):
        
        if hasattr(aq_base(obj), "objectValues"):
            for obj in obj.objectValues():
                self._recursive_reindex_object_security(obj)

        logger.debug("Reindexing object security for {}".format(repr(obj)))
        obj.reindexObjectSecurity()
793465
def push_primary_analyses_for_removal(self, analysis_request, analyses):
        
        to_remove = self.analyses_to_remove.get(analysis_request, [])
        to_remove.extend(analyses)
        self.analyses_to_remove[analysis_request] = list(set(to_remove))
1191264
def find_analysis(self, family, started_at, status):
        """"""
        query = self.Analysis.query.filter_by(
            family=family,
            started_at=started_at,
            status=status,
        )
        return query.first()
600091
function ancestorSearch (getValue, value, isAncestor, tree) {
    if (getValue(tree) === value) {
      return tree;
    }

    var index = binaryIndexBy(getValue, value, tree.children);
    var child1 = tree.children[index];
    var child0 = tree.children[index - 1];

    if (child1 && isAncestor(value, child1)) {
      return ancestorSearch(getValue, value, isAncestor, child1);
    }

    if (child0 && isAncestor(value, child0)) {
      return ancestorSearch(getValue, value, isAncestor, child0);
    }

    return tree;
  }
734136
def collect_analysis(using):
    
    python_analysis = defaultdict(dict)
    for index in registry.indexes_for_connection(using):
        python_analysis.update(index._doc_type.mapping._collect_analysis())

    return stringer(python_analysis)
1232097
def _reindex(self):
        
        self.index = []
        for path in self.paths:
            target_path = os.path.normpath(os.path.join(BASE_PATH,
                                                        path))
            for root, subdirs, files in os.walk(target_path):
                for f in files:
                    self.index.append(
                        (os.path.join(root, f).lower(),
                         os.path.join(root, f)))
107679
def _reindex(self):
        
        self._len2split_idx = {}
        last_split = -1
        for split_idx, split in enumerate(self._splits):
            self._len2split_idx.update(
                dict(list(zip(list(range(last_split + 1, split)), [split_idx] * (split - (last_split + 1))))))
1121154
def _analyze(self):
        

        self._pre_analysis()

        if self._graph_visitor is None:
            # There is no base graph that we can rely on. The analysis itself should generate successors for the
            # current job.
            # An example is the CFG recovery.

            self._analysis_core_baremetal()

        else:
            # We have a base graph to follow. Just handle the current job.

            self._analysis_core_graph()

        self._post_analysis()
529908
def _reatach(self):
        """"""
        for item, p, idx in self._detached:
            # The item may have been deleted.
            if self.treeview.exists(item) and self.treeview.exists(p):
                self.treeview.move(item, p, idx)
        self._detached = []
312108
def analysis_terminate(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/terminate' % object_id, input_params, always_retry=always_retry, **kwargs)
883676
private void analyzeFamily(final Family family) {
        Person prevChild = null;
        final FamilyNavigator navigator = new FamilyNavigator(family);
        for (final Person child : navigator.getChildren()) {
            prevChild = analyzeChild(child, prevChild);
        }
    }
712307
def system_find_analyses(input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/system/findAnalyses', input_params, always_retry=always_retry, **kwargs)
1201635
function ancestors(first, second) {
  var path = [];

  for (var n in first.path) {
    if (first.path[n] !== second.path[n]) break;
    path.push(first.path[n]);
  }
  return path;
}
407120
def apply(self, transformation, node):
        '''
        
        '''
        assert issubclass(transformation, (Transformation, Analysis))
        a = transformation()
        a.attach(self)
        res = a.apply(node)

        # the transformation updated the AST, so analyse may need to be rerun
        # we could use a finer-grain caching system, and provide a way to flag
        # some analyses as `unmodified' by the transformation, as done in LLVM
        # (and PIPS ;-)
        if a.update:
            self._cache.clear()
        return res