File: //lib64/python2.7/site-packages/dns/opcode.pyc
�
!`Nc           @   s�   d  Z  d d l Z d Z d Z d Z d Z d Z i e d 6e d	 6e d
 6e d 6e d 6Z e	 g  e j
 �  D] \ Z Z e e f ^ qi � Z
 d
 e j j f d �  �  YZ d �  Z d �  Z d �  Z d �  Z d �  Z d S(   s   DNS Opcodes.i����Ni    i   i   i   i   t   QUERYt   IQUERYt   STATUSt   NOTIFYt   UPDATEt
   UnknownOpcodec           B   s   e  Z d  Z RS(   s   Raised if an opcode is unknown.(   t   __name__t
   __module__t   __doc__(    (    (    s0   /usr/lib64/python2.7/site-packages/dns/opcode.pyR   )   s   c         C   se   |  j  �  r7 t |  � } | d k r7 | d k r7 | Sn  t j |  j �  � } | d k ra t � n  | S(   s�   Convert text into an opcode.
    @param text: the textual opcode
    @type text: string
    @raises UnknownOpcode: the opcode is unknown
    @rtype: int
    i    i   N(   t   isdigitt   intt   _by_textt   gett   uppert   NoneR   (   t   textt   value(    (    s0   /usr/lib64/python2.7/site-packages/dns/opcode.pyt	   from_text-   s    		c         C   s   |  d @d ?S(   sU   Extract an opcode from DNS message flags.
    @param flags: int
    @rtype: int
    i x  i   (    (   t   flags(    (    s0   /usr/lib64/python2.7/site-packages/dns/opcode.pyt
   from_flags?   s    c         C   s   |  d >d @S(   s`   Convert an opcode to a value suitable for ORing into DNS message
    flags.
    @rtype: int
    i   i x  (    (   R   (    (    s0   /usr/lib64/python2.7/site-packages/dns/opcode.pyt   to_flagsH   s    c         C   s.   t  j |  � } | d k r* t |  � } n  | S(   s�   Convert an opcode to text.
    @param value: the opcdoe
    @type value: int
    @raises UnknownOpcode: the opcode is unknown
    @rtype: string
    N(   t	   _by_valueR   R   t   str(   R   R   (    (    s0   /usr/lib64/python2.7/site-packages/dns/opcode.pyt   to_textP   s    	c         C   s   t  |  � t k r t St S(   sn   True if the opcode in flags is UPDATE.
    @param flags: DNS flags
    @type flags: int
    @rtype: bool
    (   R   R   t   Truet   False(   R   (    (    s0   /usr/lib64/python2.7/site-packages/dns/opcode.pyt	   is_update^   s    (   R   t
   dns.exceptiont   dnsR    R   R   R   R   R   t   dictt	   iteritemst   xt   yR   t	   exceptiont   DNSExceptionR   R   R   R   R   R   (    (    (    s0   /usr/lib64/python2.7/site-packages/dns/opcode.pyt   <module>   s&