Returns game cards URL filter for a given cardborder
    type (TAG_CARDBORDER_NORMAL / TAG_CARDBORDER_FOIL).

    To be used in URL_GAMECARDS.

    :param str|unicode cardborder_type:
    :rtype: str|unicode
559725
def get_filter_cardborder(*cardborder_type):
    
    filter_ = []

    for type_ in cardborder_type:
        if not type_:
            continue
        filter_.append('category_' + APPID_CARDS + '_cardborder[]=tag_' + type_)

    return '&'.join(filter_)
280561
def evaluate(self, source, cards=None) -> str:
		
		from ..utils import weighted_card_choice

		if cards:
			# Use specific card list if given
			self.weights = [1]
			card_sets = [list(cards)]
		elif not self.weightedfilters:
			# Use global filters if no weighted filter sets given
			self.weights = [1]
			card_sets = [self.find_cards(source)]
		else:
			# Otherwise find cards for each set of filters
			# add the global filters to each set of filters
			wf = [{**x, **self.filters} for x in self.weightedfilters]
			card_sets = [self.find_cards(source, **x) for x in wf]

		# get weighted sample of card pools
		return weighted_card_choice(source, self.weights, card_sets, self.count)
333237
def board_type(self):
        
        try:
            return self.__dict__["board_type"]
        except (KeyError, ValueError):
            raise AttributeError(
                "Instrument(order_book_id={}) has no attribute 'board_type' ".format(self.order_book_id)
            )
152440
def _get_card(self, text, **kwargs):
        

        def og_tag(key, val):
            """ produce an OpenGraph tag with the given key and value """
            return utils.make_tag('meta', {'property': key, 'content': val}, start_end=True)

        tags = og_tag('og:title', self.title(markup=False))
        tags += og_tag('og:url', self.link(absolute=True))

        card = cards.extract_card(text, kwargs, self.search_path)
        for image in card.images:
            tags += og_tag('og:image', image)
        if card.description:
            tags += og_tag('og:description',
                           self.get('Summary', card.description))

        return flask.Markup(tags)
676442
def filter_url(pkg_type, url):
    
    bad_stuff = ["?modtime", "#md5="]
    for junk in bad_stuff:
        if junk in url:
            url = url.split(junk)[0]
            break

    #pkg_spec==dev (svn)
    if url.endswith("-dev"):
        url = url.split("#egg=")[0]

    if pkg_type == "all":
        return url

    elif pkg_type == "source":
        valid_source_types = [".tgz", ".tar.gz", ".zip", ".tbz2", ".tar.bz2"]
        for extension in valid_source_types:
            if url.lower().endswith(extension):
                return url

    elif pkg_type == "egg":
        if url.lower().endswith(".egg"):
            return url
1305995
def new_limit_url(type, limit_params)
      url = URI.parse("#{base_url}/connect/#{type}s/new")

      limit_params[:merchant_id] = merchant_id
      redirect_uri = limit_params.delete(:redirect_uri)
      cancel_uri = limit_params.delete(:cancel_uri)
      state = limit_params.delete(:state)

      params = {
        :nonce       => generate_nonce,
        :timestamp   => Time.now.getutc.strftime('%Y-%m-%dT%H:%M:%SZ'),
        :client_id   => @app_id,
        type         => limit_params,
      }
      params[:redirect_uri] = redirect_uri unless redirect_uri.nil?
      params[:cancel_uri] = cancel_uri unless cancel_uri.nil?
      params[:state] = state unless state.nil?

      sign_params(params)

      url.query = Utils.normalize_params(params)
      url.to_s
    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,
        )
357933
def filter_link(model_class, filter_name, filters: {}, url_params: {})
      is_all = filter_name == :all
      config = filters[filter_name] || {}
      label = is_all ? all_label : filter_label(filter_name, filters)
      url_params =
        if config[:default] then index_params.except(:filter).merge(url_params)
        else index_params.merge(filter: filter_name).merge(url_params)
        end
      index_link(model_class, url_params: url_params) { label }
    end
1035916
def schema
      UrlScraper::TYPES.each_pair do |schema, types|
        return schema if types.include?(self.type)
      end
      nil
    end
541901
def get_type(self):
        """"""
        for card, pattern in CARDS.items():
            if pattern.match(self.number):
                return card
        return None
518473
def community_url(self):
        
        suffix = {
            EType.Individual: "profiles/%s",
            EType.Clan: "gid/%s",
        }
        if self.type in suffix:
            url = "https://steamcommunity.com/%s" % suffix[self.type]
            return url % self.as_64

        return None
1161378
def _filter_records(self, records, rtype=None, name=None, content=None, identifier=None):  # pylint: disable=too-many-arguments,no-self-use
        
        if not records:
            return []
        if identifier is not None:
            LOGGER.debug('Filtering %d records by id: %s', len(records), identifier)
            records = [record for record in records if record['id'] == identifier]
        if rtype is not None:
            LOGGER.debug('Filtering %d records by type: %s', len(records), rtype)
            records = [record for record in records if record['type'] == rtype]
        if name is not None:
            LOGGER.debug('Filtering %d records by name: %s', len(records), name)
            if name.endswith('.'):
                name = name[:-1]
            records = [record for record in records if name == record['name']]
        if content is not None:
            LOGGER.debug('Filtering %d records by content: %s', len(records), content.lower())
            records = [record for record in records if
                       record['content'].lower() == content.lower()]
        return records
779349
function filterCards(cards) {
    // Option was passed in to disabled this filter.
    // User is probably requesting to discard.
    if (noCardFilter) {
      return cards
    }
    const [head, ...tail] = cards
    if (head && head.filter) {
      return [head].concat(head.filter(tail))
    }
    return cards
  }
446000
def doGetAttrib(self, attribId):
        
        CardConnection.doGetAttrib(self, attribId)
        hresult, response = SCardGetAttrib(self.hcard, attribId)
        if hresult != 0:
            raise SmartcardException(
                'Failed to getAttrib ' + SCardGetErrorMessage(hresult))
        return response
861826
def filter_content_types(self, content_type_qs):
        
        valid_ct_ids = []
        for ct in content_type_qs:
            model = ct.model_class()
            if model and issubclass(model, EventBase):
                valid_ct_ids.append(ct.id)
        return content_type_qs.filter(pk__in=valid_ct_ids)
693129
def get_card_list(self, openid, card_id=None):
        
        card_data = {
            'openid': openid
        }
        if card_id:
            card_data['card_id'] = card_id
        return self._post(
            'card/user/getcardlist',
            data=card_data
        )
257599
public static function get_card_type($pan, $include_sub_types = false) {
        $pan = preg_replace('/\D/i', '', $pan);
        //maximum length is not fixed now, there are growing number of CCs has more numbers in length, limiting can give false negatives atm

        //these regexps accept not whole cc numbers too
        //visa
        $visa_regex = '/^4[0-9]{0,}$/';
        $vpreca_regex = '/^428485[0-9]{0,}$/';
        $postepay_regex = '/^(402360|402361|403035|417631|529948){0,}$/';
        $cartasi_regex = '/^(432917|432930|453998)[0-9]{0,}$/';
        $entropay_regex = '/^(406742|410162|431380|459061|533844|522093)[0-9]{0,}$/';
        $o2money_regex = '/^(422793|475743)[0-9]{0,}$/';

        // MasterCard
        $mastercard_regex = '/^(5[1-5]|222[1-9]|22[3-9]|2[3-6]|27[01]|2720)[0-9]{0,}$/';
        $maestro_regex = '/^(5[06789]|6)[0-9]{0,}$/';
        $kukuruza_regex = '/^525477[0-9]{0,}$/';
        $yunacard_regex = '/^541275[0-9]{0,}$/';

        // American Express
        $amex_regex = '/^3[47][0-9]{0,}$/';

        // Diners Club
        $diners_regex = '/^3(?:0[0-59]{1}|[689])[0-9]{0,}$/';

        //Discover
        $discover_regex = '/^(6011|65|64[4-9]|62212[6-9]|6221[3-9]|622[2-8]|6229[01]|62292[0-5])[0-9]{0,}$/';

        //JCB
        $jcb_regex = '/^(?:2131|1800|35)[0-9]{0,}$/';

        //ordering matter in detection, otherwise can give false results in rare cases
        if (preg_match($jcb_regex, $pan)) {
            return 'jcb';
        }

        if (preg_match($amex_regex, $pan)) {
            return 'amex';
        }

        if (preg_match($diners_regex, $pan)) {
            return 'diners_club';
        }

        //sub visa/mastercard cards
        if ($include_sub_types) {
            if (preg_match($vpreca_regex, $pan)) {
                return 'v-preca';
            }
            if (preg_match($postepay_regex, $pan)) {
                return 'postepay';
            }
            if (preg_match($cartasi_regex, $pan)) {
                return 'cartasi';
            }
            if (preg_match($entropay_regex, $pan)) {
                return 'entropay';
            }
            if (preg_match($o2money_regex, $pan)) {
                return 'o2money';
            }
            if (preg_match($kukuruza_regex, $pan)) {
                return 'kukuruza';
            }
            if (preg_match($yunacard_regex, $pan)) {
                return 'yunacard';
            }
        }

        if (preg_match($visa_regex, $pan)) {
            return 'visa';
        }

        if (preg_match($mastercard_regex, $pan)) {
            return 'mastercard';
        }

        if (preg_match($discover_regex, $pan)) {
            return 'discover';
        }

        if (preg_match($maestro_regex, $pan)) {
            if ($pan[0] == '5') {//started 5 must be mastercard
                return 'mastercard';
            }
                return 'maestro'; //maestro is all 60-69 which is not something else, thats why this condition in the end

        }

        return 'unknown'; //unknown for this system
    }