Get the cooccurrences of the given domain.

        For details, see https://investigate.umbrella.com/docs/api#co-occurrences
486345
def cooccurrences(self, domain):
        '''
        '''
        uri = self._uris["cooccurrences"].format(domain)
        return self.get_parse(uri)
1188403
private String[] queryInternal(Domain domain) throws IOException {
        Record[] records = null;
        if (domain.hostsFirst) {
            String[] ret = hosts.query(domain.domain);
            if (ret != null && ret.length != 0) {
                return ret;
            }
        }
        synchronized (cache) {
            if (Network.isNetworkChanged()) {
                cache.clear();
                synchronized (resolvers) {
                    index = 0;
                }
            } else {
                records = cache.get(domain.domain);
                if (records != null && records.length != 0) {
                    if (!records[0].isExpired()) {
                        rotate(records);
                        return records2Ip(records);
                    } else {
                        records = null;
                    }
                }
            }
        }

        IOException lastE = null;
        int firstOk = index;
        for (int i = 0; i < resolvers.length; i++) {
            int pos = (firstOk + i) % resolvers.length;
            String ip = Network.getIp();
            try {
                records = resolvers[pos].resolve(domain);
            } catch (DomainNotOwn e) {
                continue;
            } catch (IOException e) {
                lastE = e;
                e.printStackTrace();
            } catch (Exception e) {
                lastE = new IOException(e);
                e.printStackTrace();
            }
            String ip2 = Network.getIp();
            if ((records == null || records.length == 0) && ip.equals(ip2)) {
                synchronized (resolvers) {
                    if (index == firstOk) {
                        index++;
                        if (index == resolvers.length) {
                            index = 0;
                        }
                    }
                }
            } else {
                break;
            }
        }

        if (records == null || records.length == 0) {
            if (!domain.hostsFirst) {
                String[] rs = hosts.query(domain.domain);
                if (rs != null && rs.length != 0) {
                    return rs;
                }
            }
            if (lastE != null) {
                throw lastE;
            }
            throw new UnknownHostException(domain.domain);
        }
        records = trimCname(records);
        if (records.length == 0) {
            throw new UnknownHostException("no A records");
        }
        synchronized (cache) {
            cache.put(domain.domain, records);
        }
        return records2Ip(records);
    }
75276
def cooccurrence(corpus_or_featureset, featureset_name=None, min_weight=1,
                 edge_attrs=['ayjid', 'date'],
                 filter=None):
    

    if not filter:
        filter = lambda f, v, c, dc: dc >= min_weight

    featureset = _get_featureset(corpus_or_featureset, featureset_name)

    if type(corpus_or_featureset) in [Corpus, StreamingCorpus]:
        attributes = {i: {a: corpus_or_featureset.indices_lookup[i][a] for a in edge_attrs}
                      for i in corpus_or_featureset.indexed_papers.keys()}

    c = lambda f: featureset.count(f)           # Overall count.
    dc = lambda f: featureset.documentCount(f)  # Document count.
    attributes = {}

    # select applies filter to the elements in a (Structured)Feature. The
    #  iteration behavior of Feature and StructuredFeature are different, as is
    #  the manner in which the count for an element in each (Structured)Feature.
    if type(featureset) is FeatureSet:
        select = lambda feature: [f for f, v in feature
                                  if filter(f, v, c(f), dc(f))]
    elif type(featureset) is StructuredFeatureSet:
        select = lambda feature: [f for f in feature
                                  if filter(f, feature.count(f), c(f), dc(f))]

    pairs = Counter()
    eattrs = defaultdict(dict)
    nattrs = defaultdict(dict)
    nset = set()

    for paper, feature in featureset.iteritems():
        if len(feature) == 0:
            continue

        selected = select(feature)
        nset |= set(selected)
        for combo in combinations(selected, 2):
            combo = tuple(sorted(combo))
            pairs[combo] += 1

            if paper in attributes:
                eattrs[combo] = attributes[paper]

    # Generate node attributes.
    for n in list(nset):
        nattrs[n]['count'] = featureset.count(n)
        nattrs[n]['documentCount'] = featureset.documentCount(n)

    return _generate_graph(nx.Graph, pairs, edge_attrs=eattrs,
                            node_attrs=nattrs, min_weight=min_weight)
221867
def get_and_project_events(self, entity_id, gt=None, gte=None, lt=None, lte=None, limit=None, initial_state=None,
                               query_descending=False):
        
        # Decide if query is in ascending order.
        #  - A "speed up" for when events are stored in descending order (e.g.
        #  in Cassandra) and it is faster to get them in that order.
        #  - This isn't useful when 'until' or 'after' or 'limit' are set,
        #    because the inclusiveness or exclusiveness of until and after
        #    and the end of the stream that is truncated by limit both depend on
        #    the direction of the query. Also paging backwards isn't useful, because
        #    all the events are needed eventually, so it would probably slow things
        #    down. Paging is intended to support replaying longer event streams, and
        #    only makes sense to work in ascending order.
        if gt is None and gte is None and lt is None and lte is None and self.__page_size__ is None:
            is_ascending = False
        else:
            is_ascending = not query_descending

        # Get entity's domain events from the event store.
        domain_events = self.event_store.get_domain_events(
            originator_id=entity_id,
            gt=gt,
            gte=gte,
            lt=lt,
            lte=lte,
            limit=limit,
            is_ascending=is_ascending,
            page_size=self.__page_size__
        )

        # The events will be replayed in ascending order.
        if not is_ascending:
            domain_events = list(reversed(list(domain_events)))

        # Project the domain events onto the initial state.
        return self.project_events(initial_state, domain_events)
82130
def get_additional_occurrences(self, start, end):
        
        return [occ for key, occ in self.lookup.items() if (
            (end and occ.start < end) and
            occ.end >= start and not occ.cancelled)]
999771
def get_occurrence(self, occ):
        
        return self.lookup.pop(
            (occ.event, occ.original_start, occ.original_end),
            occ)
1349448
def check_domain_request(self, domains):
        
        request = E.checkDomainRequest(
            E.domains(
                E.array(
                    *[E.item(
                        E.name(domain.split(".")[0]),
                        E.extension(domain.split(".")[1])
                    ) for domain in domains]
                )
            )
        )

        response = self.request(request)
        return [Model(item) for item in response.data.array.item]
695092
def get(cls, domain, name):
        
        Site = cls
        return Session.query(Site).filter(Site.domain == domain).filter(collate(Site.name, 'NOCASE') == name).first()
768624
def get_domain_event(self, originator_id, position):
        

        sequenced_item = self.record_manager.get_item(
            sequence_id=originator_id,
            position=position,
        )
        return self.mapper.event_from_item(sequenced_item)
640631
@Override
  public Domains getAvailableDomains(Integer pageNo)
      throws DigitalOceanException, RequestUnsuccessfulException {
    return (Domains) perform(new ApiRequest(ApiAction.AVAILABLE_DOMAINS, pageNo, DEFAULT_PAGE_SIZE))
        .getData();
  }
1273514
public function getByOccurrenceID($occurrenceID, $retrieveVersion = EventService::EVENT_VERSION_APPROVED)
    {
        if ($retrieveVersion == EventService::EVENT_VERSION_RECENT) {
            $query = $this->entityManager->createQuery('select vo from calendar:CalendarEventVersionOccurrence vo JOIN
    vo.version v JOIN vo.occurrence o where o.occurrenceID = :occurrenceID order by v.evDateAdded DESC');
        } else {
            $query = $this->entityManager->createQuery('select vo from calendar:CalendarEventVersionOccurrence vo JOIN
    vo.version v JOIN vo.occurrence o where o.occurrenceID = :occurrenceID and v.evIsApproved = 1');
        }
        $query->setMaxResults(1);
        $query->setParameter('occurrenceID', $occurrenceID);
        $object = $query->getOneOrNullResult();
        return $object;
    }
166189
def get_domain_report(self, this_domain, timeout=None):
        
        params = {'apikey': self.api_key, 'domain': this_domain}

        try:
            response = requests.get(self.base + 'domain/report', params=params, proxies=self.proxies, timeout=timeout)
        except requests.RequestException as e:
            return dict(error=str(e))

        return _return_response_and_status_code(response)
333168
def with_upcoming_occurrences(self):
        
        return self.filter(
            Q(is_drop_in=False, occurrences__start__gte=djtz.now) |
            Q(Q(is_drop_in=True) | Q(occurrences__is_all_day=True), occurrences__end__gt=djtz.now)
        )
797454
@Override
	public EcodDomain getDomainsById(String ecodId) throws IOException {
		if(ecodId == null || ecodId.isEmpty()) {
			return null;
		}

		Matcher match = ECOD_RE.matcher(ecodId);
		String pdbId = null;
		if( match.matches() )
			pdbId = match.group(1);
		List<EcodDomain> doms = getDomainsForPdb(pdbId);
		if(doms == null) {
			logger.debug("Null domains for {} from {}",pdbId,ecodId);
			return null;
		}
		logger.debug("Got {} domains from {}",doms.size(),pdbId);
		for(EcodDomain d: doms) {
			if(ecodId.equals(d.getDomainId())) {
				return d;
			}
		}
		return null;
	}
891340
def get_subdomain_history(fqn, offset=None, count=None, reverse=False, db_path=None, zonefiles_dir=None, json=False):
    
    opts = get_blockstack_opts()
    if not is_subdomains_enabled(opts):
        return []

    if db_path is None:
        db_path = opts['subdomaindb_path']
    
    if zonefiles_dir is None:
        zonefiles_dir = opts['zonefiles']

    db = SubdomainDB(db_path, zonefiles_dir)
    recs = db.get_subdomain_history(fqn, offset=offset, count=count)

    if json:
        recs = [rec.to_json() for rec in recs]
        ret = {}
        for rec in recs:
            if rec['block_number'] not in ret:
                ret[rec['block_number']] = []

            ret[rec['block_number']].append(rec)

        if reverse:
            for block_height in ret:
                ret[block_height].sort(lambda r1, r2: -1 if r1['parent_zonefile_index'] > r2['parent_zonefile_index'] or 
                                                           (r1['parent_zonefile_index'] == r2['parent_zonefile_index'] and r1['zonefile_offset'] > r2['zonefile_offset']) else
                                                       1 if r1['parent_zonefile_index'] < r2['parent_zonefile_index'] or 
                                                           (r1['parent_zonefile_index'] == r2['parent_zonefile_index'] and r1['zonefile_offset'] < r2['zonefile_offset']) else
                                                       0)
        return ret

    else:
        return recs
869508
public static boolean checkAggregateReferences(Application app) {
		Map<DomainObject, Set<DomainObject>> aggregateGroups = getAggregateGroups(app);
		for (Set<DomainObject> group1 : aggregateGroups.values()) {
			for (Set<DomainObject> group2 : aggregateGroups.values()) {
				if (group1 == group2) {
					continue;
				}
				// find only the elements common to both sets, i.e. the
				// intersection
				Set<DomainObject> intersection = new HashSet<DomainObject>(
						group1);
				intersection.retainAll(group2);
				if (!intersection.isEmpty()) {
					// found two groups with some non-root objects in common,
					// i.e. reference directly to a non-root from outside the
					// aggregate boundary
					LOG.warn("checkAggregateReferences failed with intersection: "
							+ intersection);
					return false;
				}
			}
		}
		// everything alright
		return true;
	}
192854
def list_subdomains(self, domain, limit=None, offset=None):
        
        return domain.list_subdomains(limit=limit, offset=offset)