o
    h
                     @   s   d Z ddlZddlZG dd dejjZG dd dejjZ	de
defd	d
ZdedefddZdedefddZdede
fddZdedefddZejZejZejZejZejZdS )zDNS Opcodes.    Nc                   @   s8   e Zd ZdZdZdZdZdZedd Z	edd	 Z
d
S )Opcoder               c                 C   s   dS )N    clsr   r   =/var/www/html/venv/lib/python3.10/site-packages/dns/opcode.py_maximum$      zOpcode._maximumc                 C   s   t S )N)UnknownOpcoder	   r   r   r   _unknown_exception_class(   r   zOpcode._unknown_exception_classN)__name__
__module____qualname__QUERYIQUERYSTATUSNOTIFYUPDATEclassmethodr   r   r   r   r   r   r      s    
r   c                   @   s   e Zd ZdZdS )r   zAn DNS opcode is unknown.N)r   r   r   __doc__r   r   r   r   r   -   s    r   textreturnc                 C   
   t | S )zConvert text into an opcode.

    *text*, a ``str``, the textual opcode

    Raises ``dns.opcode.UnknownOpcode`` if the opcode is unknown.

    Returns an ``int``.
    )r   	from_text)r   r   r   r   r   1      

r   flagsc                 C   s   t | d@ d? S )zpExtract an opcode from DNS message flags.

    *flags*, an ``int``, the DNS flags.

    Returns an ``int``.
     x     )r   r   r   r   r   
from_flags>   s   r#   valuec                 C   s   | d> d@ S )zConvert an opcode to a value suitable for ORing into DNS message
    flags.

    *value*, an ``int``, the DNS opcode value.

    Returns an ``int``.
    r!   r    r   r$   r   r   r   to_flagsI   s   	r&   c                 C   r   )zConvert an opcode to text.

    *value*, an ``int`` the opcode value,

    Raises ``dns.opcode.UnknownOpcode`` if the opcode is unknown.

    Returns a ``str``.
    )r   to_textr%   r   r   r   r'   U   r   r'   c                 C   s   t | tjkS )zmIs the opcode in flags UPDATE?

    *flags*, an ``int``, the DNS message flags.

    Returns a ``bool``.
    )r#   r   r   r"   r   r   r   	is_updateb   s   r(   )r   dns.enumdnsdns.exceptionenumIntEnumr   	exceptionDNSExceptionr   strr   intr#   r&   r'   boolr(   r   r   r   r   r   r   r   r   r   <module>   s   
