Return a :class:`Foundation` for some deck, creating it if
        needed.
548502
def _get_foundation(self, i):
        
        if i >= len(self._foundations) or self._foundations[i] is None:
            oldfound = list(self._foundations)
            extend = i - len(oldfound) + 1
            if extend > 0:
                oldfound += [None] * extend
            width = self.card_size_hint_x * self.width
            height = self.card_size_hint_y * self.height
            found = Foundation(
                pos=self._get_foundation_pos(i), size=(width, height), deck=i
            )
            self.bind(
                pos=found.upd_pos,
                card_size_hint=found.upd_pos,
                deck_hint_step=found.upd_pos,
                size=found.upd_pos,
                deck_x_hint_offsets=found.upd_pos,
                deck_y_hint_offsets=found.upd_pos
            )
            self.bind(
                size=found.upd_size,
                card_size_hint=found.upd_size
            )
            oldfound[i] = found
            self._foundations = oldfound
        return self._foundations[i]
843900
def build_from_bases(bases, classdict, attr, attr_dict):
    """"""
    output = OrderedDict()
    output_keys = set()
    all_bases = []
    # Go through the bases from furthest to nearest ancestor
    for base in reversed(bases):
        # Only keep the items that are still defined on the bases
        if base is not object and isinstance(base, PropertyMetaclass):
            output_keys = output_keys.union(getattr(base, attr))
        # Collect all bases so we ensure overridden items are assigned
        # in the correct order
        for item in reversed(base.__mro__):
            if item is object or not isinstance(item, PropertyMetaclass):
                continue
            if item not in all_bases:
                all_bases.append(item)
    # Update the items in reverse MRO order; only keep those that are
    # defined on the bases
    for base in all_bases:
        for key, val in iteritems(getattr(base, attr)):
            if key in base.__dict__ and key in output_keys:
                output.update({key: val})
    # Remove all items that were overridden by this class; this is
    # potentially a superset of the items added back in the next step.
    for key in classdict:
        if key in output:
            output.pop(key)
    # Update the items with those defined on this class
    output.update(attr_dict)
    return output
1184105
def get_framework(cls, properties=None):
        # type: (Optional[dict]) -> Framework
        
        if cls.__singleton is None:
            # Normalize sys.path
            normalize_path()
            cls.__singleton = Framework(properties)

        return cls.__singleton
89778
def _instantiate_app(self, target_cls, kwargs):
    """"""
    parse_context = ParseContext(kwargs['address'].spec_path, dict())
    bundleprops_factory = Bundle(parse_context)
    kwargs['bundles'] = [
      bundleprops_factory.create_bundle_props(bundle)
      for bundle in kwargs['bundles']
    ]

    return target_cls(build_graph=self, **kwargs)
1163696
def _upd_unused(self, what):
        
        builder = getattr(self, '_{}_builder'.format(what))
        updtrig = getattr(self, '_trigger_upd_unused_{}s'.format(what))
        builder.unbind(decks=updtrig)
        funcs = OrderedDict()
        cards = list(self._action_builder.decks[1])
        cards.reverse()
        for card in cards:
            funcs[card.ud['funcname']] = card
        for card in self._action_builder.decks[0]:
            if card.ud['funcname'] not in funcs:
                funcs[card.ud['funcname']] = card.copy()
        unused = list(funcs.values())
        unused.reverse()
        builder.decks[1] = unused
        builder.bind(decks=updtrig)
39984
def sphinx_class(self):
        """"""
        classdoc = self.prop.sphinx_class().replace(
            ':class:`', '{info} of :class:`'
        )
        return classdoc.format(info=self.class_info)
563746
def create(blocks, mode='basic', inplanes=64, cardinality=4, image_features=64, divisor=4, num_classes=1000):
    
    block_dict = {
        # 'basic': BasicBlock,
        'bottleneck': ResNeXtBottleneck
    }

    def instantiate(**_):
        return ResNeXt(block_dict[mode], blocks, inplanes=inplanes, image_features=image_features, cardinality=cardinality, divisor=divisor, num_classes=num_classes)

    return ModelFactory.generic(instantiate)
1250138
def get_concrete_model(model):
    
    if not(inspect.isclass(model) and issubclass(model, models.Model)):
        model = get_model_by_name(model)

    return model
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
208575
def circle(opts = {})
      range  = Args::CardRange.new(opts[:range], deck_size: size)
      coords = Args::Coords.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
      draw   = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)
      range.each { |i| @cards[i].circle(coords[i], draw[i]) }
    end
581937
def make_trello_card(*args, **kwargs):
    """"""
    # Generate our card board and list
    # DEV: board is never used...
    # TODO: This is very backwards with needing a board to get a client...
    #   Might move to another lib
    # https://github.com/sarumont/py-trello/blob/0.4.3/trello/trellolist.py#L11-L20
    # https://github.com/sarumont/py-trello/blob/0.4.3/trello/trellolist.py#L48-L63
    board = Board(client=trello_client, board_id=TRELLO_BOARD_ID)
    card_list = List(board=board, list_id=TRELLO_LIST_ID)
    return card_list.add_card(*args, **kwargs)
995543
def shuffle_into_deck(self):
		
		return self.game.cheat_action(self, [actions.Shuffle(self.controller, self)])
1256080
public static function createFourOfAKind(CardCollection $cards, Hand $hand): self
    {
        $cardGroups = $cards->groupByValue();

        $firstGroup = $cardGroups->first()->first();
        $kickerGroup = $cardGroups->last()->first();

        $definition = sprintf('4 of a Kind - %ss', $firstGroup->name());

        return new static(
            self::FOUR_OF_A_KIND,
            [$firstGroup->value(), $kickerGroup->value()],
            $cards,
            $definition,
            $hand
        );
    }
1058584
def build_static(self):
        
        if not os.path.isdir(self.build_static_dir):
            os.makedirs(self.build_static_dir)
        copy_tree(self.static_dir, self.build_static_dir)
        if self.webassets_cmd:
            self.webassets_cmd.build()
513705
def make(class_name, base, schema):
    
    return type(class_name, (base,), dict(SCHEMA=schema))
884415
function Framework(spec, options) {
  if (!(this instanceof Framework)) {
    return new Framework(spec, options);
  }

  debug('create framework', spec, options);

  spec = lodash.cloneDeep(spec || {});
  options = lodash.cloneDeep(options || {});

  spec = lodash.defaults(spec, {
    swaggerVersion: '1.2',
    apis: [],
  });

  options = lodash.defaults(options,
    lodash.pick(spec, 'basePath')
  );
  delete spec.basePath;

  schema.validateThrow('ResourceListing', spec);
  schema.validateThrow(frameworkOptions, options);

  if (spec.swaggerVersion !== '1.2') {
    throw new Error('swaggerVersion not supported: ' + spec.swaggerVersion);
  }

  this.spec = spec;
  this.options = options;
  this.docs = new Docs(this);
  this.router = new Router(this);

  this.apis = {};
  this.middleware = {};
}
1152154
def _get_foundation_pos(self, i):
        
        (phx, phy) = get_pos_hint(
            self.starting_pos_hint, *self.card_size_hint
        )
        phx += self.deck_x_hint_step * i + self.deck_x_hint_offsets[i]
        phy += self.deck_y_hint_step * i + self.deck_y_hint_offsets[i]
        x = phx * self.width + self.x
        y = phy * self.height + self.y
        return (x, y)