
                             d Z ddlZdZdZdZdZdZeeeeedZej                         D  ci c]  \  } }|| 
 c}} Z
 G d d	ej                  j                        Zd
 Zd Zd Zd Zd Zyc c}} w )zDNS Opcodes.    N            )QUERYIQUERYSTATUSNOTIFYUPDATEc                       e Zd ZdZy)UnknownOpcodezAn DNS opcode is unknown.N)__name__
__module____qualname____doc__     lib/third_party/dns/opcode.pyr   r   0   s    #r   r   c                     | j                         rt        |       }|dk\  r|dk  r|S t        j                  | j	                               }|t
        |S )zConvert text into an opcode.

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

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

    Returns an ``int``.
    r      )isdigitint_by_textgetupperr   )textvalues     r   	from_textr   4   sL     ||~D	A:%2+LLL&E}Lr   c                     | dz  dz	  S )zpExtract an opcode from DNS message flags.

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

    Returns an ``int``.
     x     r   flagss    r   
from_flagsr$   H   s     FNr!!r   c                     | dz  dz  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   s    r   to_flagsr&   S   s     RK6!!r   c                 J    t         j                  |       }|t        |       }|S )zConvert an opcode to text.

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

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

    Returns a ``text``.
    )	_by_valuer   str)r   r   s     r   to_textr*   _   s%     ==D|5zKr   c                 &    t        |       t        k(  S )zmIs the opcode in flags UPDATE?

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

    Returns a ``bool``.
    )r$   r   r"   s    r   	is_updater,   o   s     e&&r   )r   dns.exceptiondnsr   r   r	   r
   r   r   itemsr(   	exceptionDNSExceptionr   r   r$   r&   r*   r,   )xys   00r   <module>r4      s   $   	
	
	
	
	
  'nn./.daQT./	$CMM.. $("	" 'E 0s   A,