HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberPanel/lib64/python3.10/site-packages/validators/__pycache__/card.cpython-310.pyc
o

��h��@s�dZddlZddlmZedefdd��Zedefdd	��Zedefd
d��Zedefdd
��Zedefdd��Z	edefdd��Z
edefdd��Zedefdd��ZdS)zCard.�N�)�	validator�valuecCsl|sdSz'ttt|��}t|ddd��}tdd�|ddd�D��}||ddkWSty5YdSw)	aiReturn whether or not given value is a valid generic card number.

    This validator is based on [Luhn's algorithm][1].

    [1]: https://github.com/mmcloughlin/luhn

    Examples:
        >>> card_number('4242424242424242')
        # Output: True
        >>> card_number('4242424242424241')
        # Output: ValidationError(func=card_number, args={'value': '4242424242424241'})

    Args:
        value:
            Generic card number string to validate

    Returns:
        (Literal[True]): If `value` is a valid generic card number.
        (ValidationError): If `value` is an invalid generic card number.
    F���N���css"�|]}ttd|d��VqdS)��
N)�sum�divmod)�.0�d�r
�E/usr/local/CyberPanel/lib/python3.10/site-packages/validators/card.py�	<genexpr>%s� zcard_number.<locals>.<genexpr>rr)�list�map�intr	�
ValueError)r�digits�odd_sum�even_sumr
r
r�card_number
s�rcC�(t�d�}t|�ot|�dko|�|�S)a�Return whether or not given value is a valid Visa card number.

    Examples:
        >>> visa('4242424242424242')
        # Output: True
        >>> visa('2223003122003222')
        # Output: ValidationError(func=visa, args={'value': '2223003122003222'})

    Args:
        value:
            Visa card number string to validate

    Returns:
        (Literal[True]): If `value` is a valid Visa card number.
        (ValidationError): If `value` is an invalid Visa card number.
    z^4���re�compiler�len�match�r�patternr
r
r�visa+�
r!cCr)a
Return whether or not given value is a valid Mastercard card number.

    Examples:
        >>> mastercard('5555555555554444')
        # Output: True
        >>> mastercard('4242424242424242')
        # Output: ValidationError(func=mastercard, args={'value': '4242424242424242'})

    Args:
        value:
            Mastercard card number string to validate

    Returns:
        (Literal[True]): If `value` is a valid Mastercard card number.
        (ValidationError): If `value` is an invalid Mastercard card number.
    z#^(51|52|53|54|55|22|23|24|25|26|27)rrrr
r
r�
mastercardAr"r#cCr)aReturn whether or not given value is a valid American Express card number.

    Examples:
        >>> amex('378282246310005')
        # Output: True
        >>> amex('4242424242424242')
        # Output: ValidationError(func=amex, args={'value': '4242424242424242'})

    Args:
        value:
            American Express card number string to validate

    Returns:
        (Literal[True]): If `value` is a valid American Express card number.
        (ValidationError): If `value` is an invalid American Express card number.
    z^(34|37)�rrr
r
r�amexWr"r%cCr)a�Return whether or not given value is a valid UnionPay card number.

    Examples:
        >>> unionpay('6200000000000005')
        # Output: True
        >>> unionpay('4242424242424242')
        # Output: ValidationError(func=unionpay, args={'value': '4242424242424242'})

    Args:
        value:
            UnionPay card number string to validate

    Returns:
        (Literal[True]): If `value` is a valid UnionPay card number.
        (ValidationError): If `value` is an invalid UnionPay card number.
    z^62rrrr
r
r�unionpaymr"r&cCs(t�d�}t|�ot|�dvo|�|�S)aReturn whether or not given value is a valid Diners Club card number.

    Examples:
        >>> diners('3056930009020004')
        # Output: True
        >>> diners('4242424242424242')
        # Output: ValidationError(func=diners, args={'value': '4242424242424242'})

    Args:
        value:
            Diners Club card number string to validate

    Returns:
        (Literal[True]): If `value` is a valid Diners Club card number.
        (ValidationError): If `value` is an invalid Diners Club card number.
    z^(30|36|38|39)>�rrrr
r
r�diners�r"r(cCr)a�Return whether or not given value is a valid JCB card number.

    Examples:
        >>> jcb('3566002020360505')
        # Output: True
        >>> jcb('4242424242424242')
        # Output: ValidationError(func=jcb, args={'value': '4242424242424242'})

    Args:
        value:
            JCB card number string to validate

    Returns:
        (Literal[True]): If `value` is a valid JCB card number.
        (ValidationError): If `value` is an invalid JCB card number.
    z^35rrrr
r
r�jcb�r"r)cCr)a�Return whether or not given value is a valid Discover card number.

    Examples:
        >>> discover('6011111111111117')
        # Output: True
        >>> discover('4242424242424242')
        # Output: ValidationError(func=discover, args={'value': '4242424242424242'})

    Args:
        value:
            Discover card number string to validate

    Returns:
        (Literal[True]): If `value` is a valid Discover card number.
        (ValidationError): If `value` is an invalid Discover card number.
    z^(60|64|65)rrrr
r
r�discover�r"r*)
�__doc__r�utilsr�strrr!r#r%r&r(r)r*r
r
r
r�<module>s&