| Current Path : /lib/python3.6/site-packages/CloudFlare/__pycache__/ |
| Current File : //lib/python3.6/site-packages/CloudFlare/__pycache__/exceptions.cpython-36.pyc |
3
�\�e� � @ s8 d Z G dd� de�ZG dd� de�ZG dd� de�ZdS )z errors for Cloudflare APIc @ sh e Zd ZdZG dd� d�Zddd�Zdd � Zd
d� Zdd
� Zdd� Z dd� Z
dd� Zdd� Zdd� Z
dS )�CloudFlareErrorz errors for Cloudflare APIc @ s0 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
S )zCloudFlareError._CodeMessagezM a small class to save away an interger and string (the code and the message)c C s || _ || _d S )N)�_code�_message)�self�code�message� r � /usr/lib/python3.6/exceptions.py�__init__ s z%CloudFlareError._CodeMessage.__init__c C s | j S )N)r )r r r r �__int__
s z$CloudFlareError._CodeMessage.__int__c C s | j S )N)r )r r r r �__str__ s z$CloudFlareError._CodeMessage.__str__c C s dt | j�t| j�f S )Nz [%d:"%s"])�intr �strr )r r r r �__repr__ s z%CloudFlareError._CodeMessage.__repr__N)�__name__�
__module__�__qualname__�__doc__r r
r r r r r r �_CodeMessage s
r � Nc C s� |rFt |t�rFtjt|�t|��| _t|dd�rBdd� |jD �| _dS tjt|�t|��| _|dk r�g | _xF|D ]>}t |tj�r�|}ntjt|d �t|d ��}| jj |� qpW dS )z errors for Cloudflare API�_error_chainFc S s g | ]}t jt|�t|���qS r )r r r r
)�.0�vr r r �
<listcomp> s z,CloudFlareError.__init__.<locals>.<listcomp>Nr r )
�
isinstance�CloudFlareAPIErrorr r r r
�_evalue�getattrr �append)r r r Zerror_chain�e�evaluer r r r r s
zCloudFlareError.__init__c C s dS )z% bool value for Cloudflare API errorsTr )r r r r �__bool__, s zCloudFlareError.__bool__c C s
t | j�S )z( integer value for Cloudflare API errors)r r )r r r r r
3 s zCloudFlareError.__int__c C s
t | j�S )z' string value for Cloudflare API errors)r
r )r r r r r 8 s zCloudFlareError.__str__c C sP dt | j�t| j�f }t| dd�rLx&| jD ]}|dt |�t|�f 7 }q,W |S )z' string value for Cloudflare API errorsz [%d:"%s"]r Fz
[%d:"%s"])r r r
r r )r �sr r r r r = s
zCloudFlareError.__repr__c C s( yt t| d��S tk
r" dS X dS )z4 Cloudflare API errors can contain a chain of errorsr r N)�lenr �AttributeError)r r r r �__len__F s zCloudFlareError.__len__c C s
| j | S )z4 Cloudflare API errors can contain a chain of errors)r )r Ziir r r �__getitem__N s zCloudFlareError.__getitem__c c s&