Display the candidates contained in a candidate record list
437282
def discands(record):
    """"""
    import pyfits
    pyraf.iraf.images()
    pyraf.iraf.images.tv()
    display = pyraf.iraf.images.tv.display
    
    width=128
    
    cands = record['cands']
    exps=   record['fileId']
    comments= record['comments']

    ### load some header info from the mophead file
    headers={}
    for exp in exps:
        f = pyfits.open(exp+".fits")
        headers[exp]={}
        for key in ['MJDATE', 'NAXIS1', 'NAXIS2', 'EXPTIME', 'FILTER']:
            headers[exp][key]=f[0].header[key]
        headers[exp]['MJD-OBSC']=headers[exp]['MJDATE']+headers[exp]['EXPTIME']/2.0/3600.0/24.0
        f.close()

    import math,os
    real=0
    cand_total=len(cands)
    if cand_total > 100 :
        sys.stderr.write("Too many candidates (%d) skipping this chip...\n" % ( cand_total))
	return -1
    for cand in cands:
        cand_total=cand_total-1
        x2=[]
        y2=[]
        y1=[]
        x1=[]
        for i in range(len(exps)):
	    #print exps[i]
            fileId=exps[i]
            x2.append(int(min(math.floor(cand[i]['x'])+width,headers[fileId]['NAXIS1'])))
            y2.append(int(min(math.floor(cand[i]['y'])+width,headers[fileId]['NAXIS2'])))
            x1.append(int(max(math.floor(cand[i]['x'])-width,1)))
            y1.append(int(max(math.floor(cand[i]['y'])-width,1)))
	#print exps
	#print x1,x2
	#print y1,y2
        x_1 = min(x1)
        y_1 = min(y1)
        x_2 = max(x2)
        y_2 = max(y2)
	ans='f'
	fake=True
	xshifts=[]
	yshifts=[]
	first_pass=True
	show_coords=True
	ans='j'
	while ( first_pass or ans == 'f' or ans == 'c') : 
	  first_pass=False
	  if ans=='c':
	    if show_coords: 
	       show_coords=False
            else:
	       show_coords=True
	  if ans=='f':
	    if fake:
	       fake=False
	    else:
	       fake=True
          for i in range(len(exps)):
            xshift=cand[i]['x']-cand[i]['x_0']
            yshift=cand[i]['y']-cand[i]['y_0']
	    allmark=open('all.coo','w')
	    for j in range(len(exps)):
	      if j==i :
	         continue
              allmark.write('%f %f\n' % ( cand[j]['x_0']+xshift, cand[j]['y_0']+yshift))
	    allmark.close()
            tvmark=open('tv.coo','w')
            tvmark.write('%f %f %d\n' % ( cand[i]['x'], cand[i]['y'], cand_total))
            x1=max(x_1 + xshift,1)
            y1=max(y_1 + yshift,1)
            x2=min(x_2 + xshift,headers[exps[i]]['NAXIS1'])
            y2=min(y_2 + yshift,headers[exps[i]]['NAXIS2'])
            cutout = "[%d:%d,%d:%d]" % (x1,x2,y1,y2)
	    if not fake:
	       if exps[i][0:2]=='fk' :
	         fileId=exps[i][2:]
	       else:
                 fileId=exps[i]
            else:
               fileId=exps[i]
#	    sys.stdout.write("---> ",fileId+cutout,xshift,yshift
            try:
                junk=display(fileId+cutout,i+1,Stdout=1)
            except:
                sys.stderr.write("ERROR\n")
            tvmark.close()
	    if show_coords:
              pyraf.iraf.images.tv.tvmark(i+1,'all.coo',mark='circle',radii=10,color=205)
              pyraf.iraf.images.tv.tvmark(i+1,'tv.coo',mark='circle',radii=8,color=204,label='yes',nxoffset=10)
            os.unlink('tv.coo')
	    os.unlink('all.coo')
        ### ask if this is a real candidate, take action.
          ans='j'
          while ans not in ('y', 'n', 'q', 's', 'f', 'c'):
            ans=raw_input("[%d] (y,n,s,q,c,f) : " % ( cand_total))
        if ans=='y':
	    if os.access("cands.REAL",os.W_OK):
                f=open("cands.REAL","a")
 	    else:
                f=open("cands.REAL","w")
	        for comment in comments:
		    f.write(comment)
            cols=['x','y','x_0','y_0','flux','size','max_int','elon']
            #for col in cols:
            #    f.write("%s\t" % col)
            f.write("\n")
            for ii in range(len(exps)):
                for col in cols:
                    f.write("%8.2f\t" % cand[ii][col])
                f.write("\n")
            f.close()
            real=real+1
        if ans=='q':
            return -2
	if ans=='s':
	    return -1
    return real
772968
def records(self):
        
        return [self._records[i] for i in range(len(self._records))]
544136
def list(self,table, **kparams):
        
        records = self.api.list(table, **kparams)
        return records
786757
def _list_records(self, rtype=None, name=None, content=None):
        """"""
        records = []
        paginator = RecordSetPaginator(self.r53_client, self.domain_id)
        for record in paginator.all_record_sets():
            if rtype is not None and record['Type'] != rtype:
                continue
            if name is not None and record['Name'] != self._fqdn_name(name):
                continue
            if record.get('AliasTarget', None) is not None:
                record_content = [record['AliasTarget'].get('DNSName', None)]
            if record.get('ResourceRecords', None) is not None:
                record_content = [self._format_content(record['Type'], value['Value']) for value
                                  in record['ResourceRecords']]
            if content is not None and content not in record_content:
                continue
            LOGGER.debug('record: %s', record)
            records.append({
                'type': record['Type'],
                'name': self._full_name(record['Name']),
                'ttl': record.get('TTL', None),
                'content': record_content[0] if len(record_content) == 1 else record_content,
            })
        LOGGER.debug('list_records: %s', records)
        return records
358575
def display(self):
        '''
        
        '''
        voc_list = []
        doc_ids = self.term_count_n.keys()
        doc_ids.sort()
        for doc_id in doc_ids:
            ngrams = len(self.term_count_n[doc_id]['ngrams'])
            print 'n-Grams (doc %s): %d' % (str(doc_id), ngrams)
            ngrams1 = len(self.term_count_n_1[doc_id]['ngrams'])
            print '(n-1)-Grams (doc %s): %d' % (str(doc_id), ngrams1)
            voc_list.append(ngrams)
        print 'Classed Vocabularies:', voc_list
        print ''
        corpus_ngrams = len(self.corpus_count_n['ngrams']) 
        print 'n-Grams (collection): %d' % (corpus_ngrams)
        corpus_ngrams1 = len(self.corpus_count_n_1['ngrams']) 
        print '(n-1)-Grams (collection): %d' % (corpus_ngrams1)
        self.unseen_counts.display()
488808
def get_cands_list_from_split(session, candidate_classes, doc, split):
    """"""
    cands = []
    if split == ALL_SPLITS:
        # Get cands from all splits
        for candidate_class in candidate_classes:
            cands.append(
                session.query(candidate_class)
                .filter(candidate_class.document_id == doc.id)
                .all()
            )
    else:
        # Get cands from the specified split
        for candidate_class in candidate_classes:
            cands.append(
                session.query(candidate_class)
                .filter(candidate_class.document_id == doc.id)
                .filter(candidate_class.split == split)
                .all()
            )
    return cands
1263199
def display_candidates(self, candidates, pdf_file=None):
        
        if not pdf_file:
            pdf_file = os.path.join(
                self.pdf_path, candidates[0][0].context.sentence.document.name
            )
            if os.path.isfile(pdf_file + ".pdf"):
                pdf_file += ".pdf"
            elif os.path.isfile(pdf_file + ".PDF"):
                pdf_file += ".PDF"
            else:
                logger.error("display_candidates failed: pdf file missing.")
        boxes = [
            get_box(mention.context) for c in candidates for mention in c.get_mentions()
        ]
        imgs = self.display_boxes(pdf_file, boxes, alternate_colors=True)
        return display(*imgs)
1087835
function list_records($cols=null, $subset=0)
    {
        if ($this->prop['searchonly'] && empty($this->filter) && !$this->group_id) {
            $this->result = new rcube_result_set(0);
            $this->result->searchonly = true;
            return $this->result;
        }

        // fetch group members recursively
        if ($this->group_id && $this->group_data['dn']) {
            $entries = $this->list_group_members($this->group_data['dn']);

            // make list of entries unique and sort it
            $seen = array();
            foreach ($entries as $i => $rec) {
                if ($seen[$rec['dn']]++)
                    unset($entries[$i]);
            }
            usort($entries, array($this, '_entry_sort_cmp'));

            $entries['count'] = count($entries);
            $this->result = new rcube_result_set($entries['count'], ($this->list_page-1) * $this->page_size);
        }
        else {
            // exec LDAP search if no result resource is stored
            if ($this->ready && $this->ldap_result === null) {
                $this->ldap_result = $this->extended_search();
            }

            // count contacts for this user
            $this->result = $this->count();

            $entries = $this->ldap_result;
        }  // end else

        // start and end of the page
        $start_row = $this->ldap->vlv_active ? 0 : $this->result->first;
        $start_row = $subset < 0 ? $start_row + $this->page_size + $subset : $start_row;
        $last_row = $this->result->first + $this->page_size;
        $last_row = $subset != 0 ? $start_row + abs($subset) : $last_row;

        // filter entries for this page
        for ($i = $start_row; $i < min($entries['count'], $last_row); $i++)
            if ($entries[$i])
                $this->result->add($this->_ldap2result($entries[$i]));

        return $this->result;
    }
337229
def _filter_candidates(self, tokens, candidates):
        """"""
        results = []
        for abbr_span, long_span in candidates:
            abbr = tokens[abbr_span[0]:abbr_span[1]]
            long = tokens[long_span[0]:long_span[1]]
            if not all(a in long for a in abbr) and len(''.join(long)) > len(''.join(abbr)):
                results.append((abbr_span, long_span))
        return results
920345
def _get_candidates(self, all_rules):
        
        candidates = []
        for rule in all_rules:
            if rule.ever_matched() and rule.time_to_report():
                candidates.append(rule)
        return candidates
1038835
def records(options={})
      options["sortField"], options["sortDirection"] = options.delete(:sort) if options[:sort]
      results = self.class.get(worksheet_url, query: options).parsed_response
      check_and_raise_error(results)
      RecordSet.new(results)
    end
359223
def show_list(self, the_list, cur_p=''):
        '''
        
        '''

        current_page_num = int(cur_p) if cur_p else 1
        current_page_num = 1 if current_page_num < 1 else current_page_num

        num_of_cat = MCollect.count_of_user(self.userinfo.uid)
        page_num = int(num_of_cat / CMS_CFG['list_num']) + 1

        kwd = {'current_page': current_page_num}

        self.render('misc/collect/list.html',
                    recs_collect=MCollect.query_pager_by_all(self.userinfo.uid,
                                                             current_page_num).objects(),
                    pager=tools.gen_pager_purecss('/collect/{0}'.format(the_list),
                                                  page_num,
                                                  current_page_num),
                    userinfo=self.userinfo,

                    cfg=CMS_CFG,
                    kwd=kwd)
787168
def nice_display(item):
    """"""
    if hasattr(item, 'all'):  # RelatedManager: display a list
        return ', '.join(map(text_type, item.all()))
    return item
321643
def _instant_search(self):
        
        _keys = []
        for k,v in self.searchables.iteritems():
            if self.string in v:
                _keys.append(k)
        self.candidates.append(_keys)
460525
private void displaySelected() {
		copySelection(table1, selected1);
		copySelection(table2, selected2);
		copySelection(table3, selected3);
	}
651760
def list_records_for_project(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
    
    data = list_records_for_project_raw(id, name, page_size, page_index, sort, q)
    if data:
        return utils.format_json_list(data)
1148818
def list_records(self, file_const=None):
        """"""
        for r in self._dataset.files:
            if file_const and r.minor_type != file_const:
                continue
            yield self.instance_from_name(r.path)