File: //var/opt/nydus/ops/oscrypto/__pycache__/_rand.cpython-39.pyc
a
�,�h � @ sN d dl mZmZmZmZ d dlZddlmZ ddlm Z m
Z
dgZdd� ZdS )� )�unicode_literals�division�absolute_import�print_functionN� )�pretty_message)� type_name� int_types�
rand_bytesc C sF t | t�sttdt| ����| dk r,td��| dkr<td��t�| �S )a}
Returns a number of random bytes suitable for cryptographic purposes
:param length:
The desired number of bytes
:raises:
ValueError - when any of the parameters contain an invalid value
TypeError - when any of the parameters are of the wrong type
OSError - when an error is returned by OpenSSL
:return:
A byte string
z;
length must be an integer, not %s
r zlength must be greater than 0i z$length must not be greater than 1024)�
isinstancer � TypeErrorr r �
ValueError�os�urandom)�length� r �?/opt/nydus/tmp/pip-target-wkfpz8uv/lib/python/oscrypto/_rand.pyr
s
�)
�
__future__r r r r r �_errorsr �_typesr r �__all__r
r r r r �<module> s �