U
    f                     @   s   d dl Z G dd de jZdS )    Nc                   @   s   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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
   V/home/www/findmeahotel.co.uk/times_travel/venv/lib/python3.8/site-packages/dns/enum.py_check_value   s    zIntEnum._check_valuec                 C   s   |  }z
| | W S  tk
r&   Y nX | |}|r:|S |  }||r|t|d   rt|t|d  }| | z
| |W S  t	k
r   | Y S X | 
 d S N)upperKeyError_extra_from_text_prefix
startswithlenisdigitintr   r   _unknown_exception_class)r   textr   prefixr
   r
   r   	from_text   s"    




zIntEnum.from_textc                 C   sZ   |  | z| |j}W n tk
r0   d }Y nX | ||}|d krV|   | }|S r   )r   r	   r   _extra_to_textr   )r   r   r   r
   r
   r   to_text1   s    

zIntEnum.to_textc                 C   sF   t |tr| |S | | z
| |W S  tk
r@   | Y S X 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
   r   make=   s    



zIntEnum.makec                 C   s   t d S r   )NotImplementedErrorr   r
   r
   r   r   T   s    zIntEnum._maximumc                 C   s
   | j  S r   )__name__lowerr    r
   r
   r   r   X   s    zIntEnum._short_namec                 C   s   dS )N r
   r    r
   r
   r   r   \   s    zIntEnum._prefixc                 C   s   d S r   r
   )r   r   r
   r
   r   r   `   s    zIntEnum._extra_from_textc                 C   s   |S r   r
   )r   r   Zcurrent_textr
   r
   r   r   d   s    zIntEnum._extra_to_textc                 C   s   t S r   )r   r    r
   r
   r   r   h   s    z IntEnum._unknown_exception_classN)r!   
__module____qualname__classmethodr   r   r   r   r   r   r   r   r   r   r
   r
   r
   r   r      s(   








r   )enumr   r
   r
   r
   r   <module>   s   