Extract the summary data from a program's detail page
516294
def extract_program_summary(data):
    '''
    
    '''
    from bs4 import BeautifulSoup
    soup = BeautifulSoup(data, 'html.parser')
    try:
        return soup.find(
            'div', {'class': 'episode-synopsis'}
        ).find_all('div')[-1].text.strip()
    except Exception:
        _LOGGER.info('No summary found for program: %s',
                     soup.find('a', {'class': 'prog_name'}))
        return "No summary"
919066
def read_summary_data(fname, component):
        
        summary = {}
        with Fast5File(fname, mode='r') as fh:
            summary['tracking_id'] = fh.get_tracking_id()
            summary['channel_id'] = fh.get_channel_info()
            read_info = fh.status.read_info
            read_summary = []
            for read in read_info:
                read_summary.append({'read_number': read.read_number,
                                     'read_id': read.read_id,
                                     'start_time': read.start_time,
                                     'duration': read.duration,
                                     'start_mux': read.start_mux})
            summary['reads'] = read_summary
            analyses_list = fh.list_analyses(component)
            _, group_names = zip(*analyses_list)
            group_names = sorted(group_names)
            group = group_names[-1]
            summary['software'] = fh.get_analysis_attributes(group)
            summary['software']['component'] = group[:-4]

            summary['data'] = fh.get_summary_data(group)
            summary['filename'] = os.path.basename(fname)
        return summary
138890
def get_summary(section, domain, uri, use_cache):
    """"""
    logging.debug('Checking for a cached summary file')

    cachefile = "{section}_{domain}_assembly_summary.txt".format(section=section, domain=domain)
    full_cachefile = os.path.join(CACHE_DIR, cachefile)
    if use_cache and os.path.exists(full_cachefile) and \
       datetime.utcnow() - datetime.fromtimestamp(os.path.getmtime(full_cachefile)) < timedelta(days=1):
        logging.info('Using cached summary.')
        with codecs.open(full_cachefile, 'r', encoding='utf-8') as fh:
            return StringIO(fh.read())

    logging.debug('Downloading summary for %r/%r uri: %r', section, domain, uri)
    url = '{uri}/{section}/{domain}/assembly_summary.txt'.format(
        section=section, domain=domain, uri=uri)
    req = requests.get(url)

    if use_cache:
        try:
            os.makedirs(CACHE_DIR)
        except OSError as err:
            # Errno 17 is "file exists", ignore that, otherwise re-raise
            if err.errno != 17:
                raise

        with codecs.open(full_cachefile, 'w', encoding='utf-8') as fh:
            fh.write(req.text)

    return StringIO(req.text)
120455
def render_summary(self, include_title=True):
        """"""
        title = ""
        classes = ["traceback"]
        if not self.frames:
            classes.append("noframe-traceback")
            frames = []
        else:
            library_frames = sum(frame.is_library for frame in self.frames)
            mark_lib = 0 < library_frames < len(self.frames)
            frames = [group.render(mark_lib=mark_lib) for group in self.groups]

        if include_title:
            if self.is_syntax_error:
                title = u"Syntax Error"
            else:
                title = u"Traceback <em>(most recent call last)</em>:"

        if self.is_syntax_error:
            description_wrapper = u"<pre class=syntaxerror>%s</pre>"
        else:
            description_wrapper = u"<blockquote>%s</blockquote>"

        return SUMMARY_HTML % {
            "classes": u" ".join(classes),
            "title": u"<h3>%s</h3>" % title if title else u"",
            "frames": u"\n".join(frames),
            "description": description_wrapper % escape(self.exception),
        }
587975
def __summary(self):
        """"""
        text = "Time: %s\n" % self.when
        text += "Comitter: %s\n" % self.editor

        inst = self.timemachine.presently

        if self.action_type == "dl":
            text += "Deleted %s\n" % inst._object_type_text()
        elif self.action_type == "cr":
            text += "Created %s\n" % inst._object_type_text()
        else:
            text += "Modified %s\n" % inst._object_type_text()
        text += self._details(nohtml=True)
        return text
92536
def extract_data(self, page):
        """"""
        response_keys = set(page.keys())
        uncommon_keys = response_keys - self.common_keys

        for possible_data_key in uncommon_keys:
            element = page[possible_data_key]
            if isinstance(element, dict):
                return [self.representation(self.client, self.service_name,
                                            element)]
            if isinstance(element, list):
                return [self.representation(self.client, self.service_name, x)
                        for x in element]
1320041
def get_context_data(self, **kwargs):
        """"""
        context = super().get_context_data(**kwargs)
        tabs = self.get_active_tabs()
        context.update({
            'page_detail_tabs': tabs,
            'active_tab': tabs[0].code if tabs else '',
            'app_label': self.get_app_label(),
            'model_name': self.get_model_name(),
            'model_alias': self.get_model_alias(),
            'model_verbose_name': self.object._meta.verbose_name.title(),
            'back_url': self.get_back_url(),
            'edit_url': self.get_edit_url(),
            'delete_url': self.get_delete_url(),
            'title': self.title,
        })
        return context
765916
private Collection<DetailInfo> getDetailInfosForPage(CmsResource containerPage) {

        if (m_detailInfosByPage == null) {
            m_detailInfosByPage = ArrayListMultimap.create();
            for (DetailInfo detailInfo : m_detailInfos) {
                m_detailInfosByPage.put(detailInfo.getDetailPageInfo().getUri(), detailInfo);
            }
        }
        String folderPath = CmsResource.getParentFolder(containerPage.getRootPath());
        Collection<DetailInfo> result = m_detailInfosByPage.get(containerPage.getRootPath());
        if (result.isEmpty()) {
            result = m_detailInfosByPage.get(folderPath);
        }
        return result;
    }
474435
def _summarize_result(result, summary):
    
    if "Bit for Bit" not in summary:
        summary["Bit for Bit"] = [0, 0]
    if "Configurations" not in summary:
        summary["Configurations"] = [0, 0]
    if "Std. Out Files" not in summary:
        summary["Std. Out Files"] = 0

    # Get the number of bit for bit failures
    total_count = 0
    failure_count = 0
    summary_data = None
    for elem in result:
        if elem["Type"] == "Bit for Bit" and "Data" in elem:
            elem_data = elem["Data"]
            summary_data = summary["Bit for Bit"]
            total_count += 1
            for var in six.iterkeys(elem_data):
                if elem_data[var]["Max Error"] != 0:
                    failure_count += 1
                    break
    if summary_data is not None:
        summary_data = np.add(summary_data, [total_count-failure_count, total_count]).tolist()
        summary["Bit for Bit"] = summary_data

    # Get the number of config matches
    summary_data = None
    total_count = 0
    failure_count = 0
    for elem in result:
        if elem["Title"] == "Configuration Comparison" and elem["Type"] == "Diff":
            elem_data = elem["Data"]
            summary_data = summary["Configurations"]
            total_count += 1
            failed = False
            for section_name, varlist in elem_data.items():
                for var, val in varlist.items():
                    if not val[0]:
                        failed = True
            if failed:
                failure_count += 1
    if summary_data is not None:
        success_count = total_count - failure_count
        summary_data = np.add(summary_data, [success_count, total_count]).tolist()
        summary["Configurations"] = summary_data

    # Get the number of files parsed
    for elem in result:
        if elem["Title"] == "Output Log" and elem["Type"] == "Table":
            summary["Std. Out Files"] += 1
            break
    return 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])
324090
async def get_details(self):
        
        data = await self._handler.details(system_id=self.system_id)
        return bson.decode_all(data)[0]
1243020
function executorSummary(computers) {

  var data = {};

  computers.forEach(function (computer) {

    var idleCount   = 0;
    var activeCount = 0;

    data[computer.displayName] = { executors: [] };

    computer.executors.forEach(function (executor) {
      data[computer.displayName].executors.push({
        idle: executor.idle,
        stuck: executor.likelyStuck,
        progress: executor.progress,
        name: (!executor.idle && executor.currentExecutable.url) ?
          executor.currentExecutable.url.replace(/.*\/job\//, '').replace(/\/.*/, '') :
          undefined
      });

      if (executor.idle) {
        idleCount += 1;
      } else {
        activeCount += 1;
      }
    });

    var summary = [];
    if (activeCount > 0) {
      summary.push(text.__('%d active', activeCount));
    }
    if (idleCount > 0) {
      summary.push(text.__('%d idle', idleCount));
    }

    data[computer.displayName].summary = summary.join(', ');
  });

  return data;
}
125369
def Main(url):
    '''
    
    '''
    # The object of Web-Scraping.
    web_scrape = WebScraping()
    # Execute Web-Scraping.
    document = web_scrape.scrape(url)
    # The object of automatic summarization with N-gram.
    auto_abstractor = NgramAutoAbstractor()
    # n-gram object
    auto_abstractor.n_gram = Ngram()
    # n of n-gram
    auto_abstractor.n = 3
    # Set tokenizer. This is japanese tokenizer with MeCab.
    auto_abstractor.tokenizable_doc = MeCabTokenizer()
    # Object of abstracting and filtering document.
    abstractable_doc = TopNRankAbstractor()
    # Execute summarization.
    result_dict = auto_abstractor.summarize(document, abstractable_doc)

    # Output 3 summarized sentences.
    limit = 3
    i = 1
    for sentence in result_dict["summarize_result"]:
        print(sentence)
        if i >= limit:
            break
        i += 1
129377
def summary():
    """"""
    exp = experiment(session)
    return success_response(field="summary",
                            data=exp.log_summary(),
                            request_type="summary")
757747
public function debug_summary() {
        $summary = '';
        $summary .= 'General type: ' . $this->pagelayout . '. ';
        if (!during_initial_install()) {
            $summary .= 'Context ' . $this->context->get_context_name() . ' (context id ' . $this->_context->id . '). ';
        }
        $summary .= 'Page type ' . $this->pagetype .  '. ';
        if ($this->subpage) {
            $summary .= 'Sub-page ' . $this->subpage .  '. ';
        }
        return $summary;
    }
136519
def parse_page(page):
    """"""
    colors = get_config()['colors']
    with io.open(page, encoding='utf-8') as f:
        lines = f.readlines()
    output_lines = []
    for line in lines[1:]:
        if is_headline(line):
            continue
        elif is_description(line):
            output_lines.append(click.style(line.replace('>', ' '),
                                            fg=colors['description']))
        elif is_old_usage(line):
            output_lines.append(click.style(line, fg=colors['usage']))
        elif is_code_example(line):
            line = '  ' + line if line.startswith('`') else line[2:]
            output_lines.append(click.style(line.replace('`', ''),
                                            fg=colors['command']))
        elif is_line_break(line):
            output_lines.append(click.style(line))
        else:
            output_lines.append(click.style('- ' + line, fg=colors['usage']))
    return output_lines
615935
function PullSummary () {
   this.files = [];
   this.insertions = {};
   this.deletions = {};

   this.summary = {
      changes: 0,
      insertions: 0,
      deletions: 0
   };

   this.created = [];
   this.deleted = [];
}