o
    2c                     @   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r|  }t| d| d S )Nr   z must be between >= 0 and <= )_maximum_short_name
ValueError)clsvaluemaxname r
   >/var/www/html/gps/gps/lib/python3.10/site-packages/dns/enum.py_check_value   s
   zIntEnum._check_valuec                 C   s   |  }z| | W S  ty   Y nw |  }||rF|t|d   rFt|t|d  }| | z| |W S  tyE   | Y S w | 	 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y   |   |  Y S w r   )r   r	   r   r   r   r   r
   r
   r   to_text-   s   
zIntEnum.to_textc                 C   s@   t |tr
| |S | | z| |W S  ty   | Y S w )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.
        )
isinstancestrr   r   r   r   r
   r
   r   make5   s   



zIntEnum.makec                 C   s   t r   )NotImplementedErrorr   r
   r
   r   r   L      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   r    zIntEnum._prefixc                 C   s   t S r   )r   r   r
   r
   r   r   X   r    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   