https://t.me/RX1948
Server : LiteSpeed
System : Linux srv107862549.host 5.15.0-124-generic #134-Ubuntu SMP Fri Sep 27 20:20:17 UTC 2024 x86_64
User : malam2778 ( 1069)
PHP Version : 8.0.30
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /usr/local/CyberCP/lib/python3.10/site-packages/validators/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/CyberCP/lib/python3.10/site-packages/validators/iban.py
import re

from .utils import validator

regex = (
    r'^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$'
)
pattern = re.compile(regex)


def char_value(char):
    """A=10, B=11, ..., Z=35
    """
    if char.isdigit():
        return int(char)
    else:
        return 10 + ord(char) - ord('A')


def modcheck(value):
    """Check if the value string passes the mod97-test.
    """
    # move country code and check numbers to end
    rearranged = value[4:] + value[:4]
    # convert letters to numbers
    converted = [char_value(char) for char in rearranged]
    # interpret as integer
    integerized = int(''.join([str(i) for i in converted]))
    return (integerized % 97 == 1)


@validator
def iban(value):
    """
    Return whether or not given value is a valid IBAN code.

    If the value is a valid IBAN this function returns ``True``, otherwise
    :class:`~validators.utils.ValidationFailure`.

    Examples::

        >>> iban('DE29100500001061045672')
        True

        >>> iban('123456')
        ValidationFailure(func=iban, ...)

    .. versionadded:: 0.8

    :param value: IBAN string to validate
    """
    return pattern.match(value) and modcheck(value)

https://t.me/RX1948 - 2025