Lists the most popular recent tags in decreasing popularity from a specific ticket.
494249
def tags(self, ticket_id):
        
        return self._query_zendesk(self.endpoint.tags, 'tag', id=ticket_id)
919846
def list_recent_networks(self) -> List[Network]:
        """"""
        most_recent_times = (
            self.session
            .query(
                Network.name.label('network_name'),
                func.max(Network.created).label('max_created')
            )
            .group_by(Network.name)
            .subquery('most_recent_times')
        )

        and_condition = and_(
            most_recent_times.c.network_name == Network.name,
            most_recent_times.c.max_created == Network.created
        )

        most_recent_networks = self.session.query(Network).join(most_recent_times, and_condition)

        return most_recent_networks.all()
496326
function favorites_by_tags( $tid, $page = 1, $count = 50)
	{
		$params = array();
		$params['tid'] = $tid;
		$params['count'] = $count;
		$params['page'] = $page;
		return $this->oauth->get( 'favorites/by_tags', $params );
	}
697083
def tickets(self, extra_params=None):
        
        return filter(
            lambda ticket: ticket.get('milestone_id', None) == self['id'],
            self.space.tickets(extra_params=extra_params)
        )
1171404
def query_recent(num=8, **kwargs):
        '''
        
        '''
        order_by_create = kwargs.get('order_by_create', False)
        kind = kwargs.get('kind', None)
        if order_by_create:
            if kind:
                recent_recs = TabPost.select().where(
                    (TabPost.kind == kind) & (TabPost.valid == 1)
                ).order_by(
                    TabPost.time_create.desc()
                ).limit(num)
            else:
                recent_recs = TabPost.select().where(
                    TabPost.valid == 1
                ).order_by(
                    TabPost.time_create.desc()
                ).limit(num)
        else:
            if kind:
                recent_recs = TabPost.select().where(
                    (TabPost.kind == kind) & (TabPost.valid == 1)
                ).order_by(
                    TabPost.time_update.desc()
                ).limit(num)
            else:
                recent_recs = TabPost.select().where(
                    TabPost.valid == 1
                ).order_by(
                    TabPost.time_update.desc()
                ).limit(num)
        return recent_recs
579985
def tag_list(self):
        """"""
        tags = [tag.strip() for tag in self.tag_string.split(",")]
        return sorted(filter(None, tags))
1032936
def filter(self, scored_list):
        '''
        

        '''
        top_n_key = -1 * self.top_n
        top_n_list = sorted(scored_list, key=lambda x: x[1])[top_n_key:]
        result_list = sorted(top_n_list, key=lambda x: x[0])
        return result_list
650179
def ordered_tags(self):
        
        tags = list(self.tags.all())
        return sorted(
            tags,
            key=lambda tag: ((type(tag) != Tag) * 100000) + tag.count(),
            reverse=True
        )
1037484
def ticket_tags_delete(self, id, **kwargs):
        ""
        api_path = "/api/v2/tickets/{id}/tags.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, method="DELETE", **kwargs)
1354296
def post_event_ticket_classes(self, id, **data):
        
        
        return self.post("/events/{0}/ticket_classes/".format(id), data=data)
1334325
def recent(self, with_catalog=True, with_date=True):
        '''
        
        '''
        kwd = {
            'pager': '',
            'title': 'Recent posts.',
            'with_catalog': with_catalog,
            'with_date': with_date,
        }
        self.render('list/post_list.html',
                    kwd=kwd,
                    view=MPost.query_recent(num=20),
                    postrecs=MPost.query_recent(num=2),
                    format_date=tools.format_date,
                    userinfo=self.userinfo,
                    cfg=CMS_CFG, )
404530
def tickets_list(self, external_id=None, include=None, **kwargs):
        ""
        api_path = "/api/v2/tickets.json"
        api_query = {}
        if "query" in kwargs.keys():
            api_query.update(kwargs["query"])
            del kwargs["query"]
        if external_id:
            api_query.update({
                "external_id": external_id,
            })
        if include:
            api_query.update({
                "include": include,
            })
        return self.call(api_path, query=api_query, **kwargs)
280323
def get_tags(self):
    """"""
    return sorted([frozenset(meta_graph.meta_info_def.tags)
                   for meta_graph in self.meta_graphs])
1186507
def favorites(self):
        
        return bind_api(
            api=self,
            path='/favorites/list.json',
            payload_type='status', payload_list=True,
            allowed_param=['screen_name', 'user_id', 'max_id', 'count', 'since_id', 'max_id']
        )
10814
def get_last(postid, limit=10):
        '''
        
        '''
        recs = TabPostHist.select().where(
            TabPostHist.post_id == postid
        ).order_by(TabPostHist.time_update.desc()).limit(limit)
        if recs.count():
            return recs.get()
        return None
1287973
def top(self, limit=None):
        
        return self._reddit.top(self.display_name, limit=limit)
521375
def most_visited_venues_card(num=10):
    
    if spectator_apps.is_enabled('events'):

        object_list = most_visited_venues(num=num)

        object_list = chartify(object_list, 'num_visits', cutoff=1)

        return {
            'card_title': 'Most visited venues',
            'score_attr': 'num_visits',
            'object_list': object_list,
        }