Displays a card showing the Creators that are associated with the most Events.
326187
def most_seen_creators_card(event_kind=None, num=10):
    
    object_list = most_seen_creators(event_kind=event_kind, num=num)

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

    return {
        'card_title': 'Most seen people/groups',
        'score_attr': 'num_events',
        'object_list': object_list,
    }
329642
def show():
    """"""
    items = list(collection.find())
    # JSON conversion chokes on the _id objects, so we convert
    # them to strings here
    for i in items:
        i['_id'] = str(i['_id'])
    return items
618385
static function creatorLimitationList()
    {
        $creators =& eZPackageCreationHandler::creatorList();
        $list = array();
        foreach ( $creators as $creator )
        {
            $list[] = array( 'name' => $creator->attribute( 'name' ),
                             'id' => $creator->attribute( 'id' ) );
        }
        return $list;
    }
196642
def day_publications_card(date):
    
    d = date.strftime(app_settings.DATE_FORMAT)
    card_title = 'Reading on {}'.format(d)
    return {
            'card_title': card_title,
            'publication_list': day_publications(date=date),
            }
993024
def draw(self):
        
        obverse = slice(0, None)
        reverse = slice(None, None, -1)
        nbreak = len(self.key)
        themeable = self.theme.figure._themeable

        # When there is more than one guide, we keep
        # record of all of them using lists
        if 'legend_title' not in themeable:
            themeable['legend_title'] = []
        if 'legend_text_legend' not in themeable:
            themeable['legend_key'] = []
            themeable['legend_text_legend'] = []

        # title
        title_box = TextArea(self.title, textprops=dict(color='black'))
        themeable['legend_title'].append(title_box)

        # labels
        labels = []
        for item in self.key['label']:
            if isinstance(item, np.float) and np.float.is_integer(item):
                item = np.int(item)  # 1.0 to 1
            va = 'center' if self.label_position == 'top' else 'baseline'
            ta = TextArea(item, textprops=dict(color='black', va=va))
            labels.append(ta)
            themeable['legend_text_legend'].extend(labels)

        # Drawings
        drawings = []
        for i in range(nbreak):
            da = ColoredDrawingArea(self._keywidth[i],
                                    self._keyheight[i],
                                    0, 0, color='white')
            # overlay geoms
            for gl in self.glayers:
                with suppress(IndexError):
                    data = gl.data.iloc[i]
                    da = gl.geom.draw_legend(data, da, gl.layer)
            drawings.append(da)
        themeable['legend_key'].append(drawings)

        # Match Drawings with labels to create the entries
        lookup = {
            'right': (HPacker, reverse),
            'left': (HPacker, obverse),
            'bottom': (VPacker, reverse),
            'top': (VPacker, obverse)}
        packer, slc = lookup[self.label_position]
        entries = []
        for d, l in zip(drawings, labels):
            e = packer(children=[l, d][slc],
                       sep=self._label_margin,
                       align='center',
                       pad=0)
            entries.append(e)

        # Put the entries together in rows or columns
        # A chunk is either a row or a column of entries
        # for a single legend
        if self.byrow:
            chunk_size, packers = self.ncol, [HPacker, VPacker]
            sep1 = self._legend_entry_spacing_x
            sep2 = self._legend_entry_spacing_y
        else:
            chunk_size, packers = self.nrow, [VPacker, HPacker]
            sep1 = self._legend_entry_spacing_y
            sep2 = self._legend_entry_spacing_x

        if self.reverse:
            entries = entries[::-1]
        chunks = []
        for i in range(len(entries)):
            start = i*chunk_size
            stop = start + chunk_size
            s = islice(entries, start, stop)
            chunks.append(list(s))
            if stop >= len(entries):
                break

        chunk_boxes = []
        for chunk in chunks:
            d1 = packers[0](children=chunk,
                            align='left',
                            sep=sep1, pad=0,)
            chunk_boxes.append(d1)

        # Put all the entries (row & columns) together
        entries_box = packers[1](children=chunk_boxes,
                                 align='baseline',
                                 sep=sep2, pad=0)

        # Put the title and entries together
        packer, slc = lookup[self.title_position]
        children = [title_box, entries_box][slc]
        box = packer(children=children,
                     sep=self._title_margin,
                     align=self._title_align,
                     pad=self._legend_margin)

        return box
165840
def top_cards(self, number=1, cache=True, remove=True):
        
        getter = partial(self.get_card(cache=cache, remove=remove))
        return [getter(index=i) for i in range(number)]
1338997
function (card, cb) {

		Card.findOrCreate(card.id, card)
	    .exec(function (err, foundCard){
	      if (err) return cb(err);
	      if (foundCard.lastStripeEvent > card.lastStripeEvent) return cb(null, foundCard);
	      if (foundCard.lastStripeEvent == card.lastStripeEvent) return Card.afterStripeCustomerCardUpdated(foundCard, function(err, card){ return cb(err, card)});
	      Card.update(foundCard.id, card)
	      .exec(function(err, updatedCards){
	      	if (err) return cb(err);
	      	if (!updatedCards) return cb(null, null);
	      	Card.afterStripeCustomerCardUpdated(updatedCards[0], function(err, card){
	      		cb(err, card);
	      	});
	      });
	    });
	}
1104744
def merge(id, card, cardscript=None):
		
		if card is None:
			card = cardxml.CardXML(id)

		if cardscript is None:
			cardscript = get_script_definition(id)

		if cardscript:
			card.scripts = type(id, (cardscript, ), {})
		else:
			card.scripts = type(id, (), {})

		scriptnames = (
			"activate", "combo", "deathrattle", "draw", "inspire", "play",
			"enrage", "update", "powered_up"
		)

		for script in scriptnames:
			actions = getattr(card.scripts, script, None)
			if actions is None:
				# Set the action by default to avoid runtime hasattr() calls
				setattr(card.scripts, script, [])
			elif not callable(actions):
				if not hasattr(actions, "__iter__"):
					# Ensure the actions are always iterable
					setattr(card.scripts, script, (actions, ))

		for script in ("events", "secret"):
			events = getattr(card.scripts, script, None)
			if events is None:
				setattr(card.scripts, script, [])
			elif not hasattr(events, "__iter__"):
				setattr(card.scripts, script, [events])

		if not hasattr(card.scripts, "cost_mod"):
			card.scripts.cost_mod = None

		if not hasattr(card.scripts, "Hand"):
			card.scripts.Hand = type("Hand", (), {})

		if not hasattr(card.scripts.Hand, "events"):
			card.scripts.Hand.events = []

		if not hasattr(card.scripts.Hand.events, "__iter__"):
			card.scripts.Hand.events = [card.scripts.Hand.events]

		if not hasattr(card.scripts.Hand, "update"):
			card.scripts.Hand.update = ()

		if not hasattr(card.scripts.Hand.update, "__iter__"):
			card.scripts.Hand.update = (card.scripts.Hand.update, )

		# Set choose one cards
		if hasattr(cardscript, "choose"):
			card.choose_cards = cardscript.choose[:]
		else:
			card.choose_cards = []

		if hasattr(cardscript, "tags"):
			for tag, value in cardscript.tags.items():
				card.tags[tag] = value

		# Set some additional events based on the base tags...
		if card.poisonous:
			card.scripts.events.append(POISONOUS)

		return card
758981
def showcase(opts = {})
      range    = Args::CardRange.new(opts[:range], deck_size: size)
      showcase = Args::ShowcaseSpecial.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
      sheet    = Args::Sheet.new(custom_colors, { file: 'showcase.png' }).load!(opts, expand_by: size, layout: layout, dpi: dpi)
      render_showcase(range, sheet, showcase)
    end
752917
def get_cards_stats(ctx, currency, skip_owned, appid, foil):
    """"""

    username = ctx.obj['username']
    cards_by_app = defaultdict(list)

    inventory = User(username).traverse_inventory(item_filter=TAG_ITEM_CLASS_CARD)
    for item in inventory:
        appid_ = item.app.appid
        if not appid or appid_ in appid:
            cards_by_app[appid_].append(item)

    if not cards_by_app:
        click.secho('User `%s` has no cards' % username, fg='red', err=True)
        return

    for appid_, cards in cards_by_app.items():
        app = cards[0].app
        print_card_prices(
            app.appid, currency,
            owned_cards=[card.title for card in cards],
            skip_owned=skip_owned,
            foil=foil,
        )
388621
def payment_methods(self):
		
		for source in self.sources.iterator():
			yield source

		for card in self.legacy_cards.iterator():
			yield card
343882
def find_all_valid_cards(provider: Provider, deck: Deck) -> Generator:
    ''''''

    # validate_card_issue_modes must recieve a full list of cards, not batches
    unfiltered = (card for batch in get_card_bundles(provider, deck) for card in batch)

    for card in validate_card_issue_modes(deck.issue_mode, list(unfiltered)):
        yield card
631808
function renderEvents(events, modifiedEventId) {
		var i, len=events.length,
			dayEvents=[],
			slotEvents=[];
		for (i=0; i<len; i++) {
			if (events[i].allDay) {
				dayEvents.push(events[i]);
			}else{
				slotEvents.push(events[i]);
			}
		}

		if (opt('allDaySlot')) {
			renderDayEvents(dayEvents, modifiedEventId);
			setHeight(); // no params means set to viewHeight
		}

		renderSlotSegs(compileSlotSegs(slotEvents), modifiedEventId);
	}
656673
def render():
    ''''''
    from udata.core.organization.models import Organization
    from udata.core.post.models import Post
    from udata.core.reuse.models import Reuse
    from udata.core.user.models import User

    header('Rendering images')

    count = Counter()
    total = Counter()

    organizations = Organization.objects(logo__exists=True)
    total['orgs'] = organizations.count()
    log.info('Processing {0} organizations logos'.format(total['orgs']))
    for org in organizations:
        count['orgs'] += render_or_skip(org, 'logo')

    users = User.objects(avatar__exists=True)
    total['users'] = users.count()
    log.info('Processing {0} user avatars'.format(total['users']))
    for user in users:
        count['users'] += render_or_skip(user, 'avatar')

    posts = Post.objects(image__exists=True)
    total['posts'] = posts.count()
    log.info('Processing {0} post images'.format(total['posts']))
    for post in posts:
        count['posts'] += render_or_skip(post, 'image')

    reuses = Reuse.objects(image__exists=True)
    total['reuses'] = reuses.count()
    log.info('Processing {0} reuse images'.format(total['reuses']))
    for reuse in reuses:
        count['reuses'] += render_or_skip(reuse, 'image')

    log.info('''Summary:
    Organization logos: {count[orgs]}/{total[orgs]}
    User avatars: {count[users]}/{total[users]}
    Post images: {count[posts]}/{total[posts]}
    Reuse images: {count[reuses]}/{total[reuses]}
    '''.format(count=count, total=total))
    success('Images rendered')
94381
function getCardWeight(player, target, card, game) {
  let moves = []
  if (card.validPlays) {
    moves = card.validPlays(player, target, game)
  }
  if (card.validCounters && target.discard.length) {
    moves = card.validCounters(player, target, game)
  }
  if (card.validDisasters) {
    moves = card.validDisasters(player, game)
  }
  // Pick out the highest weight of those moves
  return moves.reduce((acc, move) => {
    return move.weight > acc ? move.weight : acc
  }, 0)
}
1343969
private function _cardSign($cardid = null, $attr = array())
    {
        unset($attr['outer_id']);
        $attr['cardId'] = $cardid;
        $attr['timestamp'] = time();
        $attr['api_ticket'] = $this->getJsCardTicket();
        $attr['nonce_str'] = Tools::createNoncestr();
        $attr['signature'] = $this->getTicketSignature($attr);
        unset($attr['api_ticket']);
        return $attr;
    }
395085
def get_top_artists(self, limit=None, cacheable=True):
        """"""

        params = {}
        if limit:
            params["limit"] = limit

        doc = _Request(self, "chart.getTopArtists", params).execute(cacheable)

        return _extract_top_artists(doc, self)