o
    ei                     @   s6   d Z ddlmZ dd ZdddZdd	 Zd
d ZdS )z
Common validation functions
    )
basestringc                 C   s   t | tstd|| f dS )z<Require that value is a string

    :raises: TypeError

    z+%s must be a str or unicode str, but got %rN)
isinstancer   	TypeError)value
value_name r   N/var/www/html/pca-backend/venv/lib/python3.10/site-packages/pika/validators.pyrequire_string   s   
r	   callbackc                 C   s   t | std|| f dS )zORequire that callback is callable and is not None

    :raises: TypeError

    z(callback %s must be callable, but got %rNcallabler   )r
   callback_namer   r   r   require_callback   s   r   c                 C   s    | du rdS t | rdS td)z~Verify callback is callable if not None

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

    NTFz0completion callback must be callable if not Noner   r
   r   r   r   rpc_completion_callback"   s
   r   c                 C   s$   t |dk rd| |}t|dS )zuVerify that value is zero or greater. If not, 'name'
    will be used in error message

    :raises: ValueError

    r   z{} must be >= 0, but got {}N)intformat
ValueError)namer   errmsgr   r   r   zero_or_greater6   s   r   Nr   )__doc__pika.compatr   r	   r   r   r   r   r   r   r   <module>   s    
