Convert to the next higher level summary level
5020
def promote(self, level=None):
        """"""

        if level is None:

            if len(self.fields) < 2:
                if self.level in ('region', 'division', 'state', 'ua'):
                    cls = self.get_class('us')
                else:
                    return None
            else:
                cls = self.get_class(self.fields[-2])
        else:
            cls = self.get_class(level)

        d = dict(self.__dict__.items())
        d['sl'] = self.sl

        return cls(**d)
235539
def build_summary(val1=None, val2=None, val3=None):
        
        summary = []
        if val1 is not None:
            summary.append(val1)
        if val2 is not None:
            summary.append(val2)
        if val3 is not None:
            summary.append(val3)
        if not summary:
            return None
        return ' : '.join(summary)
164441
def get_summary_str(self, sec2d_nt):
        """"""
        data = self.get_summary_data(sec2d_nt)
        return "{M} GO IDs placed into {N} sections; {U} unplaced GO IDs".format(
            N=len(data['sections']), M=len(data['grouped']), U=len(data['ungrouped']))
1079734
private void renderTotalsRow() {
        docBuilder.append("12+^|*"+ i18n.getMessage("summary.total")+"*", newLine()).
            append(tableCol(), scenarioTotalizationsCache.getTotalPassedScenarios(), tableCol(), scenarioTotalizationsCache.getTotalFailedScenarios()).
                append(tableCol(), scenarioTotalizationsCache.getTotalScenarios()).
                append(tableCol(), scenarioTotalizationsCache.getTotalPassedSteps(), tableCol(), scenarioTotalizationsCache.getTotalFailedSteps()).
                append(tableCol(), scenarioTotalizationsCache.getTotalSkippedSteps(), tableCol(), scenarioTotalizationsCache.getTotalPendingSteps()).
                append(tableCol(), scenarioTotalizationsCache.getTotalUndefinedSteps(), tableCol(), scenarioTotalizationsCache.getTotalMissingSteps()).
            append(tableCol(), scenarioTotalizationsCache.getTotalSteps(), " 2+", tableCol(), Formatter.formatTime(scenarioTotalizationsCache.getTotalDuration()));
        docBuilder.newLine();
    }
691366
def next(self):
        """"""
        if self.tokens:
            other = self.copy()
            tok = other.tokens.pop()
            other.tokens.append(tok.next())
            return other
        else:
            return Version.inf
794276
private void readNextChar(final JsonLevel level) throws EOFException {
        int readerIndex = content.readerIndex();
        int lastWsIndex = content.forEachByte(wsProcessor);

        if (lastWsIndex == -1 && level != null) {
            throw NEED_MORE_DATA;
        }
        if (lastWsIndex > readerIndex) {
            this.content.skipBytes(lastWsIndex - readerIndex);
            this.content.discardReadBytes();
        }

        this.currentChar = this.content.readByte();
    }
369215
def _previous(self):
        """"""
        self.summaries.rotate()
        current_summary = self.summaries[0]
        self._update_summary(current_summary)
310322
def _write_summary_cnts(self, cnts):
        """"""
        # Count level(shortest path to root) and depth(longest path to root)
        # values for all unique GO Terms.
        max_val = max(max(dep for dep in cnts['depth']),
                      max(lev for lev in cnts['level']))
        self.log.write('Dep <-Depth Counts->  <-Level Counts->\n')
        self.log.write('Lev   BP    MF    CC    BP    MF    CC\n')
        self.log.write('--- ----  ----  ----  ----  ----  ----\n')
        for i in range(max_val+1):
            vals = ['{:>5}'.format(cnts[desc][i][ns]) for desc in sorted(cnts) for ns in self.nss]
            self.log.write('{:>02} {}\n'.format(i, ' '.join(vals)))
1114
def string_to_level(log_level):
  
  if (log_level.strip().upper() == "DEBUG"):
    return logging.DEBUG
  if (log_level.strip().upper() == "INFO"):
    return logging.INFO
  if (log_level.strip().upper() == "WARNING"):
    return logging.WARNING
  if (log_level.strip().upper() == "ERROR"):
    return logging.ERROR
1108862
function unshiftArticle(summary, article) {
    article = SummaryArticle(article);

    var parts = summary.getParts();
    var part = parts.get(0) || SummaryPart();

    var articles = part.getArticles();
    articles = articles.unshift(article);
    part = part.set('articles', articles);

    parts = parts.set(0, part);
    summary = summary.set('parts', parts);

    return indexLevels(summary);
}
115806
def _get_summary(rsync_out):
    '''
    
    '''

    return "- " + "\n- ".join([elm for elm in rsync_out.split("\n\n")[-1].replace("  ", "\n").split("\n") if elm])
1170399
def GetRunlevelsNonLSB(states):
  """"""
  if not states:
    return set()
  convert_table = {
      "0": "0",
      "1": "1",
      "2": "2",
      "3": "3",
      "4": "4",
      "5": "5",
      "6": "6",
      # SysV, Gentoo, Solaris, HP-UX all allow an alpha variant
      # for single user. https://en.wikipedia.org/wiki/Runlevel
      "S": "1",
      "s": "1"
  }
  _LogInvalidRunLevels(states, convert_table)
  return set([convert_table[s] for s in states.split() if s in convert_table])
1040125
def _purecn_summary(call, data):
    
    out = {}
    for svtype, coords in get_coords(data):
        cur_calls = {k: collections.defaultdict(int) for k in coords.keys()}
        with open(call["loh"]) as in_handle:
            in_handle.readline()  # header
            for line in in_handle:
                _, chrom, start, end, _, cn, minor_cn = line.split(",")[:7]
                start = int(start)
                end = int(end)
                for region, cur_coords in coords.items():
                    if chrom == cur_coords[0] and are_overlapping((start, end), cur_coords[1:]):
                        cur_calls[region][_check_copy_number_changes(svtype, _to_cn(cn), _to_cn(minor_cn), data)] += 1
        out[svtype] = {r: _merge_cn_calls(c, svtype) for r, c in cur_calls.items()}
    with open(call["hetsummary"]) as in_handle:
        vals = dict(zip(in_handle.readline().strip().replace('"', '').split(","),
                        in_handle.readline().strip().split(",")))
    out["purity"] = vals["Purity"]
    out["ploidy"] = vals["Ploidy"]
    return out
883696
def toc(self, depth=6, lowest_level=6):
        
        depth = min(max(depth, 0), 6)
        depth = 6 if depth == 0 else depth
        lowest_level = min(max(lowest_level, 1), 6)
        toc = self._root.to_dict()['children']

        def traverse(curr_toc, dep, lowest_lvl, curr_depth=1):
            if curr_depth > dep:
                # clear all items of this depth and exit the recursion
                curr_toc.clear()
                return

            items_to_remove = []
            for item in curr_toc:
                if item['level'] > lowest_lvl:
                    # record item with low header level, for removing it later
                    items_to_remove.append(item)
                else:
                    traverse(item['children'], dep, lowest_lvl, curr_depth + 1)
            [curr_toc.remove(item) for item in items_to_remove]

        traverse(toc, depth, lowest_level)
        return toc
316920
def reorder_levels(self, order):
        
        order = [self._get_level_number(i) for i in order]
        if len(order) != self.nlevels:
            raise AssertionError('Length of order must be same as '
                                 'number of levels (%d), got %d' %
                                 (self.nlevels, len(order)))
        new_levels = [self.levels[i] for i in order]
        new_codes = [self.codes[i] for i in order]
        new_names = [self.names[i] for i in order]

        return MultiIndex(levels=new_levels, codes=new_codes,
                          names=new_names, verify_integrity=False)
685720
def _parse_summary(self):
        """"""
        if self._is_at_section():
            return

        # If several signatures present, take the last one
        while True:
            summary = self._doc.read_to_next_empty_line()
            summary_str = " ".join([s.strip() for s in summary]).strip()
            if re.compile('^([\w., ]+=)?\s*[\w\.]+\(.*\)$').match(summary_str):
                self['Signature'] = summary_str
                if not self._is_at_section():
                    continue
            break

        if summary is not None:
            self['Summary'] = summary

        if not self._is_at_section():
            self['Extended Summary'] = self._read_to_next_section()
916995
def summary(self, title=None, complexity=False):
        
        if title is None:
            return javabridge.call(
                self.jobject, "toSummaryString", "()Ljava/lang/String;")
        else:
            return javabridge.call(
                self.jobject, "toSummaryString", "(Ljava/lang/String;Z)Ljava/lang/String;", title, complexity)