Return the type if it matches one of the cards.
541901
def get_type(self):
        """"""
        for card, pattern in CARDS.items():
            if pattern.match(self.number):
                return card
        return None
270231
def _guess_type(val):
        """"""
        if isinstance(val, bool):
            return "choice"
        elif isinstance(val, int):
            return "number"
        elif isinstance(val, float):
            return "number"
        elif isinstance(val, str):
            return "text"
        elif hasattr(val, 'read'):
            return "file"
        else:
            return "text"
652094
def _guess_type(self, full_path):
        """"""
        magic = self._match_magic(full_path)
        if magic is not None:
            return (mimetypes.guess_type(magic.old_path(full_path))[0]
                    or 'text/plain')
        else:
            return mimetypes.guess_type(full_path)[0] or 'text/plain'
304564
def _types_match(type1, type2):
        
        if isinstance(type1, six.string_types) and \
                isinstance(type2, six.string_types):
            type1 = type1.rstrip('?')
            type2 = type2.rstrip('?')
            if type1 != type2:
                return False

        return True
1039012
function (type, item, hard) {
        if (hard) {
            return harderTypes[type](getType(item), item);
        }
        return (getType(item) === simpleTypes[type]);
    }
1046354
def credit_card_number(self, card_type: Optional[CardType] = None) -> str:
        
        length = 16
        regex = re.compile(r'(\d{4})(\d{4})(\d{4})(\d{4})')

        if card_type is None:
            card_type = get_random_item(CardType, rnd=self.random)

        if card_type == CardType.VISA:
            number = self.random.randint(4000, 4999)
        elif card_type == CardType.MASTER_CARD:
            number = self.random.choice([
                self.random.randint(2221, 2720),
                self.random.randint(5100, 5599),
            ])
        elif card_type == CardType.AMERICAN_EXPRESS:
            number = self.random.choice([34, 37])
            length = 15
            regex = re.compile(r'(\d{4})(\d{6})(\d{5})')
        else:
            raise NonEnumerableError(CardType)

        str_num = str(number)
        while len(str_num) < length - 1:
            str_num += self.random.choice(string.digits)

        groups = regex.search(  # type: ignore
            str_num + luhn_checksum(str_num),
        ).groups()
        card = ' '.join(groups)
        return card
468439
def same_kind(self, other):
        

        return type(self) is type(other) and self._same_parameters(other)
1173719
def search(self, type, **args):
        """"""
        if type not in VALID_SEARCH_TYPES:
            raise GraphAPIError(
                "Valid types are: %s" % ", ".join(VALID_SEARCH_TYPES)
            )

        args["type"] = type
        return self.request(self.version + "/search/", args)
606769
def get_match(self, match_key, card_type="full_card"):
        

        match_url = self.api_path + "match/" + match_key + "/"
        params = {}
        params["card_type"] = card_type
        response = self.get_response(match_url, params)
        return response
111812
def guess_type(s):
    
    sc = s.replace(',', '') # remove comma from potential numbers

    try:
        return int(sc)
    except ValueError:
        pass

    try:
        return float(sc)
    except ValueError:
        pass

    return s
1254633
function (pack, card) {
    if (cardPacks[pack] && cardPacks[pack].cards[card]) {
      return cardPacks[pack].cards[card];
    }
  }
1295402
def extract_type(s):
    """"""
    r = re.compile(r"<class '(.*)'>", re.MULTILINE | re.IGNORECASE)
    try:
        m = r.match(str(s)).group(1)
    except (IndexError, AttributeError) as e:
        m = None

    return m
759565
def match_type(mtype, patterns):
    ''''''
    for p in patterns:
        if fnmatch.fnmatch(mtype, p):
            return True
    return False
1000420
private function getPatternType($cardNumber)
    {
        if (empty($cardNumber)) return;

        $types = [
            'visa'          => '(4\d{12}(?:\d{3})?)',
            'amex'          => '(3[47]\d{13})',
            'jcb'           => '(35[2-8][89]\d\d\d{10})',
            'maestro'       => '((?:5020|5038|6304|6579|6761)\d{12}(?:\d\d)?)',
            'solo'          => '((?:6334|6767)\d{12}(?:\d\d)?\d?)',
            'mastercard'    => '(5[1-5]\d{14})',
            'switch'        => '(?:(?:(?:4903|4905|4911|4936|6333|6759)\d{12})|(?:(?:564182|633110)\d{10})(\d\d)?\d?)',
        ];
        $names      = ['visa','amex', 'jcb', 'maestro', 'solo', 'mastercard', 'switch'];

        $matches    = [];

        $pattern    = "#^(?:" . implode('|', $types)  . ")$#";

        $result     = preg_match($pattern, str_replace(' ', '', $cardNumber), $matches);

        return $result > 0 ? $names[sizeof($matches)-2] : false;
    }
1098672
def credit_card_provider(self, card_type=None):
        
        if card_type is None:
            card_type = self.random_element(self.credit_card_types.keys())
        return self._credit_card_type(card_type).name
771245
boolean matches(int type, int child1, int child2) {
        return matches(type, child1) && get(2, true).isA(child2);
    }
1159092
def match(self, name, rdclass, rdtype, covers, deleting=None):
        """"""

        if not super(RRset, self).match(rdclass, rdtype, covers):
            return False
        if self.name != name or self.deleting != deleting:
            return False
        return True