Returns a dictionary with all the tag clouds related to a site.
333416
def cloudata(site):
	

	# XXX: this looks like it can be done via ORM
	tagdata = getquery("""
		SELECT feedjack_post.feed_id, feedjack_tag.name, COUNT(*)
		FROM feedjack_post, feedjack_subscriber, feedjack_tag,
		feedjack_post_tags
		WHERE feedjack_post.feed_id=feedjack_subscriber.feed_id AND
		feedjack_post_tags.tag_id=feedjack_tag.id AND
		feedjack_post_tags.post_id=feedjack_post.id AND
		feedjack_subscriber.site_id=%d
		GROUP BY feedjack_post.feed_id, feedjack_tag.name
		ORDER BY feedjack_post.feed_id, feedjack_tag.name""" % site.id)
	tagdict = {}
	globaldict = {}
	cloudict = {}
	for feed_id, tagname, tagcount in tagdata:
		if feed_id not in tagdict:
			tagdict[feed_id] = []
		tagdict[feed_id].append((tagname, tagcount))
		try:
			globaldict[tagname] += tagcount
		except KeyError:
			globaldict[tagname] = tagcount
	tagdict[0] = globaldict.items()
	for key, val in tagdict.items():
		cloudict[key] = build(site, val)
	return cloudict
1149523
def as_dict(self):
        
        tags_dict = dict(self)
        tags_dict['@module'] = self.__class__.__module__
        tags_dict['@class'] = self.__class__.__name__
        return tags_dict
351374
def tags(self):
        
        tags = set()
        for i in self:
            tags |= set(i.keys())
        return tags
875227
def Tags(self):
    
    return {
        IMAGES: self.images.Keys(),
        AUDIO: self.audios.Keys(),
        HISTOGRAMS: self.histograms.Keys(),
        SCALARS: self.scalars.Keys(),
        COMPRESSED_HISTOGRAMS: self.compressed_histograms.Keys(),
        TENSORS: self.tensors.Keys(),
        # Use a heuristic: if the metagraph is available, but
        # graph is not, then we assume the metagraph contains the graph.
        GRAPH: self._graph is not None,
        META_GRAPH: self._meta_graph is not None,
        RUN_METADATA: list(self._tagged_metadata.keys())
    }
169491
def tags(self):
        ''''''
        return itertools.product(
            self.py_version.split('.'),
            self.abi.split('.'),
            self.platform.split('.'),
        )
168268
def search_site(self, keyword):
        
        if not keyword:
            raise ValueError('Must provide a valid keyword')

        url = self.build_url(
            self._endpoints.get('search').format(keyword=keyword))

        response = self.con.get(url)
        if not response:
            return []

        data = response.json()

        # Everything received from cloud must be passed as self._cloud_data_key
        return [
            self.site_constructor(parent=self, **{self._cloud_data_key: site})
            for site in data.get('value', [])]
385662
def get_queryset(self):
        '''
        
        '''
        queryset = super(PageList, self).get_queryset()
        if hasattr(self.request, 'site_id'):
            queryset = queryset.filter(site_id=self.request.site_id)
        return queryset
540723
def tags(self):
        ''
        if self._tags is None:
            config = global_config('dossier.tags')
            self._tags = self.create(Tags, config=config)
        return self._tags
387369
def all(cls, domain=None):
        
        Site = cls
        site = Session.query(Site)
        if domain:
            site.filter(Site.domain == domain)
        return site.all()
453019
def _get_elements(self, site):
        
        try:
            if isinstance(site.specie, Element):
                return [site.specie]
            return [Element(site.specie)]
        except:
            return site.species.elements
1318090
def get_all(self):
        
        if not self.vars:
            return self.parent
        if not self.parent:
            return self.vars
        return dict(self.parent, **self.vars)
150607
def tags(self):
		'''

		'''
		q = meta.Session.query(_tag.Tag)
		q = q.join(TagSemanticTag)
		q = q.filter_by(tag_id=self.id)
#		q = q.filter_by(state='active')
		q = q.order_by(_tag.Tag.name)
		tags = q.all()
		return tags
983624
def get_hosts_dict(self) -> Dict:
        
        return {
            k: deserializer.inventory.InventoryElement.serialize(v).dict()
            for k, v in self.hosts.items()
        }
915133
def get_aggregate(self):
        
        return dict([(aggregate.find('query').text, [(ET.tostring(data).lstrip('<data xmlns:cps="www.clusterpoint.com" xmlns:cpse="www.clusterpoint.com">').strip().rstrip("</data>")) for data in aggregate.findall('data')])
                   for aggregate in self._content.findall('aggregate')])
354753
def query_all():
        '''
        
        '''
        recs = TabPost2Tag.select(
            TabPost2Tag,
            TabTag.kind.alias('tag_kind'),
        ).join(
            TabTag,
            on=(TabPost2Tag.tag_id == TabTag.uid)
        )
        return recs
302531
def build(site, tagdata):
	

	tagdata.sort()

	# we get the most popular tag to calculate the tags' weigth
	tagmax = 0
	for tagname, tagcount in tagdata:
		if tagcount > tagmax:
			tagmax = tagcount
	steps = getsteps(site.tagcloud_levels, tagmax)

	tags = []
	for tagname, tagcount in tagdata:
		weight = [twt[0] \
			for twt in steps if twt[1] >= tagcount and twt[1] > 0][0]+1
		tags.append({'tagname':tagname, 'count':tagcount, 'weight':weight})
	return tags
718890
def clouds(self, id=None, name=None, provider=None, search=None):
        
        if self._clouds is None:
            self._clouds = {}
            self._list_clouds()

        if id:
            return [self._clouds[cloud_id] for cloud_id in self._clouds.keys()
                    if id == self._clouds[cloud_id].id]
        elif name:
            return [self._clouds[cloud_id] for cloud_id in self._clouds.keys()
                    if name == self._clouds[cloud_id].title]
        elif provider:
            return [self._clouds[cloud_id] for cloud_id in self._clouds.keys()
                    if provider == self._clouds[cloud_id].provider]
        elif search:
            return [self._clouds[cloud_id] for cloud_id in self._clouds.keys()
                    if search in self._clouds[cloud_id].title
                    or search in self._clouds[cloud_id].id
                    or search in self._clouds[cloud_id].provider]
        else:
            return [self._clouds[cloud_id] for cloud_id in self._clouds.keys()]