
                         V   d Z ddlZddlZdZdZdZdZdZdZ	eeeeee	dZ
e
j                         D  ci c]  \  } }|| 
 c}} Ze
j                  eeed	       ed
e	d
iZ ej                  dej                         Z G d dej$                  j&                        Zd Zd Zd Zyc c}} w )zDNS Rdata Classes.    N               )	RESERVED0INCHHSNONEANY)INTERNETCHAOSHESIODTzCLASS([0-9]+)$c                       e Zd ZdZy)UnknownRdataclasszA DNS class is unknown.N)__name__
__module____qualname____doc__     !lib/third_party/dns/rdataclass.pyr   r   ?   s    !r   r   c                     t         j                  | j                               }|Lt        j	                  |       }|t
        t        |j                  d            }|dk  s|dkD  rt        d      |S )a  Convert text into a DNS rdata class value.

    The input text can be a defined DNS RR class mnemonic or
    instance of the DNS generic class syntax.

    For example, "IN" and "CLASS1" will both result in a value of 1.

    Raises ``dns.rdatatype.UnknownRdataclass`` if the class is unknown.

    Raises ``ValueError`` if the rdata class value is not >= 0 and <= 65535.

    Returns an ``int``.
    r   r     'class must be between >= 0 and <= 65535)	_by_textgetupper_unknown_class_patternmatchr   intgroup
ValueError)textvaluer!   s      r   	from_textr'   C   sh     LL&E}&,,T2=##EKKN#19FGGLr   c                 z    | dk  s| dkD  rt        d      t        j                  |       }|dt        |       z   }|S )a  Convert a DNS rdata type value to text.

    If the value has a known mnemonic, it will be used, otherwise the
    DNS generic class syntax will be used.

    Raises ``ValueError`` if the rdata class value is not >= 0 and <= 65535.

    Returns a ``str``.
    r   r   r   CLASS)r$   	_by_valuer   repr)r&   r%   s     r   to_textr,   ]   sC     qyEEMBCC==D|e$Kr   c                     | t         v ryy)zTrue if the specified class is a metaclass.

    The currently defined metaclasses are ANY and NONE.

    *rdclass* is an ``int``.
    TF)_metaclasses)rdclasss    r   is_metaclassr0   p   s     ,r   )r   redns.exceptiondnsr   r	   r
   r   r   r   r   itemsr*   updater.   compileIr    	exceptionDNSExceptionr   r'   r,   r0   )xys   00r   <module>r<      s   $  	 	
	 


 'nn./.daQT./	
 	  	$
 $$4bdd; "22 "4&
I 0s   B%