Return existing ids (and names) from a soup.
500385
def find_existing_anchors(soup):
  """"""
  existing_anchors = set()
  for tag in soup.find_all(True):
    for attr in ['id', 'name']:
      if tag.has_attr(attr):
        existing_anchors.add(tag.get(attr))
  return existing_anchors
248805
def maybe_readable_combine_ids(cls, ids):
    
    ids = list(ids)  # We can't len a generator.
    return ids[0] if len(ids) == 1 else cls.combine_ids(ids)
41573
def ids(self):
        """"""
        as_list = [seq.description.split()[0] for seq in self]
        as_set = frozenset(as_list)
        assert len(as_set) == len(as_list)
        return as_set
391034
def get_dict_w_id2nts(ids, id2nts, flds, dflt_null=""):
    """"""
    assert len(ids) == len(set(ids)), "NOT ALL IDs ARE UNIQUE: {IDs}".format(IDs=ids)
    assert len(flds) == len(set(flds)), "DUPLICATE FIELDS: {IDs}".format(
        IDs=cx.Counter(flds).most_common())
    usr_id_nt = []
    # 1. Instantiate namedtuple object
    ntobj = cx.namedtuple("Nt", " ".join(flds))
    # 2. Fill dict with namedtuple objects for desired ids
    for item_id in ids:
        # 2a. Combine various namedtuples into a single namedtuple
        nts = [id2nt.get(item_id) for id2nt in id2nts]
        vals = _combine_nt_vals(nts, flds, dflt_null)
        usr_id_nt.append((item_id, ntobj._make(vals)))
    return cx.OrderedDict(usr_id_nt)
670437
def identifierSearches(self,
                           ids=None,
                           LIMIT=25,
                           _print=True,
                           crawl=False):
        """"""
        url_base = self.base_url + '/api/1/term/view/{id}' + '?key=' + self.api_key
        urls = [url_base.format(id=str(_id)) for _id in ids]
        return self.get(
            urls=urls,
            LIMIT=LIMIT,
            action='Searching For Terms',
            crawl=crawl,
            _print=_print)
349969
def match_id(self, el, ids):
        """"""

        found = True
        for i in ids:
            if i != self.get_attribute_by_name(el, 'id', ''):
                found = False
                break
        return found
1090276
def str_id(self):
        ""
        id_or_name = self.id_or_name
        if id_or_name is not None and isinstance(id_or_name, str):
            return id_or_name
        return None
126715
def _has_name(soup_obj):
    """"""
    try:
        name = soup_obj.name
        if name == None:
            return False
        return True
    except AttributeError:
        return False
1268330
def _rebuild_key_ids(self):
        """"""
        self._key_ids = collections.defaultdict(list)
        for i, x in enumerate(self._pairs):
            self._key_ids[x[0]].append(i)
102538
def get_empty_ids(self):
        
        cursor = self.get_collection().find(
            {
                '_id': {'$in': self._document_ids},
                self._field: {'$exists': True}
            },
            {'_id': True}
        )

        return set(self._document_ids) - {doc['_id'] for doc in cursor}
1180023
def get_queryset(self):
        
        queryset = super(MultipleIDMixin, self).get_queryset()
        if hasattr(self.request, 'query_params'):
            ids = dict(self.request.query_params).get('ids[]')
        else:
            ids = dict(self.request.QUERY_PARAMS).get('ids[]')
        if ids:
            queryset = queryset.filter(id__in=ids)
        return queryset
1203097
def _parse_list(s):
    """"""
    # Range: 'x-y'
    if '-' in s:
        m, M = map(_parse_arg, s.split('-'))
        return list(range(m, M + 1))
    # List of ids: 'x,y,z'
    elif ',' in s:
        return list(map(_parse_arg, s.split(',')))
    else:
        return _parse_arg(s)
911401
def batch_fetch_labels(ids):
    
    m = {}
    for id in ids:
        label = anyont_fetch_label(id)
        if label is not None:
            m[id] = label
    return m
115537
def get_soup(url):
    """"""
    html = requests.get(url, stream=True, headers=HEADERS)
    if html.status_code != 404:
        return BeautifulSoup(html.content, 'html.parser')
    else:
        return None
1107780
def _get_soup(page):
	""""""
	request = requests.get(page)
	data = request.text
	return bs4.BeautifulSoup(data)
118085
def get_rows(self):
        """"""
        table = self.soup.find_all('tr')[1:-3]
        return [row for row in table if row.contents[3].string]
1219609
def _get_dict(names, ndarrays):
        """"""
        nset = set()
        for nm in names:
            if nm in nset:
                raise ValueError('Duplicate names detected, %s' % str(names))
            nset.add(nm)
        return dict(zip(names, ndarrays))