o
    'hk                     @   s>   d dl Z d dlmZmZmZ edddZG dd de jZdS )    N)TypeTypeVarUnionTIntEnumIntEnum)boundc                   @   s   e Zd Zedd Zedd Zedee dedefdd	Z	edee d
e
defddZedee d
ee
ef def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 )r   c                 C   s>   |  | t| |}| |d p|   | |_||_|S N)_check_valueint__new___extra_to_text_prefix_name__value_)clsvalueval r   D/var/www/html/olx_land/venv/lib/python3.10/site-packages/dns/enum.py	_missing_   s
   
zIntEnum._missing_c                 C   sD   |   }t|tst|dk s||kr |  }t| d| d S )Nr   z$ must be an int between >= 0 and <= )_maximum
isinstancer
   	TypeError_short_name
ValueError)r   r   maxnamer   r   r   r	   !   s   
zIntEnum._check_valuer   textreturnc                 C   s   |  }z| | W S  ty   Y nw | |}|r|S |  }||rO|t|d   rOt|t|d  }| | z| |W S  t	yN   | Y S w | 
 r   )upperKeyError_extra_from_textr   
startswithlenisdigitr
   r	   r   _unknown_exception_class)r   r   r   prefixr   r   r   	from_text*   s&   



zIntEnum.from_textr   c                 C   sX   |  | z| |j}W n ty   d }Y nw | ||}|d u r*|   | }|S r   )r	   r   r   r   r   )r   r   r   r   r   r   to_text>   s   
zIntEnum.to_textc                 C   s&   t |tr
| |S | | | |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.
        )r   strr'   r	   )r   r   r   r   r   makeJ   s   


zIntEnum.makec                 C   s   t r   )NotImplementedErrorr   r   r   r   r   ^      zIntEnum._maximumc                 C   s
   | j  S r   )__name__lowerr,   r   r   r   r   b   s   
zIntEnum._short_namec                 C   s   dS )N r   r,   r   r   r   r   f   r-   zIntEnum._prefixc                 C   s   d S r   r   )r   r   r   r   r   r!   j   r-   zIntEnum._extra_from_textc                 C   s   |S r   r   )r   r   current_textr   r   r   r   n   r-   zIntEnum._extra_to_textc                 C   s   t S r   )r   r,   r   r   r   r%   r   r-   z IntEnum._unknown_exception_classN)r.   
__module____qualname__classmethodr   r	   r   r   r)   r'   r
   r(   r   r*   r   r   r   r!   r   r%   r   r   r   r   r      s.    

$




)enumtypingr   r   r   r   r   r   r   r   r   <module>   s   