a
    sd_
                     @   s   d dl Z G dd de jZdS )    Nc                   @   sl   e Zd Zedd Zedd Zedd Zedd Zed	d
 Zedd Z	edd Z
edd ZdS )IntEnumc                 C   s6   |   }|dk s||kr2|  }t| d| d S )Nr   z must be between >= 0 and <= )_maximum_short_name
ValueError)clsvaluemaxname r
   */usr/lib/python3/dist-packages/dns/enum.py_check_value   s    zIntEnum._check_valuec                 C   s   |  }z
| | W S  ty$   Y n0 |  }||r|t|d   rt|t|d  }| | z
| |W S  ty   | Y S 0 | 	 d S N)
upperKeyError_prefix
startswithlenisdigitintr   r   _unknown_exception_class)r   textprefixr   r
   r
   r   	from_text   s    



zIntEnum.from_textc                 C   s>   |  | z| |jW S  ty8   |   |  Y S 0 d S r   )r   r	   r   r   r   r   r
   r
   r   to_text-   s
    
zIntEnum.to_textc                 C   sD   t |tr| |S | | z
| |W S  ty>   | Y S 0 dS )a  Convert text or a value into an enumerated type, if possible.

        *value*, the ``int`` or ``str`` to convert.

        Raises a class-specific exception if a ``str`` is provided that
        cannot be converted.

        Raises ``ValueError`` if the value is out of range.

        Returns an enumeration from the calling class corresponding to the
        value, if one is defined, or an ``int`` otherwise.
        N)
isinstancestrr   r   r   r   r
   r
   r   make5   s    



zIntEnum.makec                 C   s   t d S r   )NotImplementedErrorr   r
   r
   r   r   L   s    zIntEnum._maximumc                 C   s
   | j  S r   )__name__lowerr   r
   r
   r   r   P   s    zIntEnum._short_namec                 C   s   dS )N r
   r   r
   r
   r   r   T   s    zIntEnum._prefixc                 C   s   t S r   )r   r   r
   r
   r   r   X   s    z IntEnum._unknown_exception_classN)r    
__module____qualname__classmethodr   r   r   r   r   r   r   r   r
   r
   r
   r   r      s    






r   )enumr   r
   r
   r
   r   <module>   s   