U
    *”}f€	  ã                   @   s4   d dl mZmZmZ d dlmZ G dd„ deƒZdS )é    )Úabsolute_importÚdivisionÚprint_function)Úutilsc                   @   sJ   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ Zedd„ ƒZ	e
 d¡ZdS )ÚObjectIdentifierc              	   C   sÐ   || _ | j  d¡}g }|D ]V}zt|dƒ}W n" tk
rN   td| j  ƒ‚Y nX |dk rftd| j  ƒ‚| |¡ qt|ƒdk rŒtd| j  ƒ‚|d dkr¦td| j  ƒ‚|d dk rÌ|d	 d
krÌtd| j  ƒ‚d S )NÚ.é
   z%Malformed OID: %s (non-integer nodes)r   z*Malformed OID: %s (negative-integer nodes)é   z0Malformed OID: %s (insufficient number of nodes)z2Malformed OID: %s (first node outside valid range)é   é(   z3Malformed OID: %s (second node outside valid range))Ú_dotted_stringÚsplitÚintÚ
ValueErrorÚappendÚlen)ÚselfÚdotted_stringZnodesZintnodesÚnodeZ
node_value© r   ú</tmp/pip-unpacked-wheel-x36vw73o/cryptography/hazmat/_oid.pyÚ__init__   sJ    ÿÿ
ÿÿÿÿÿÿÿÿzObjectIdentifier.__init__c                 C   s   t |tƒstS | j|jkS ©N)Ú
isinstancer   ÚNotImplementedr   ©r   Úotherr   r   r   Ú__eq__5   s    
zObjectIdentifier.__eq__c                 C   s
   | |k S r   r   r   r   r   r   Ú__ne__;   s    zObjectIdentifier.__ne__c                 C   s   d  | j| j¡S )Nz#<ObjectIdentifier(oid={}, name={})>)Úformatr   Ú_name©r   r   r   r   Ú__repr__>   s     ÿzObjectIdentifier.__repr__c                 C   s
   t | jƒS r   )Úhashr   r!   r   r   r   Ú__hash__C   s    zObjectIdentifier.__hash__c                 C   s   ddl m} | | d¡S )Nr   )Ú
_OID_NAMESzUnknown OID)Zcryptography.x509.oidr%   Úget)r   r%   r   r   r   r    F   s    zObjectIdentifier._namer   N)Ú__name__Ú
__module__Ú__qualname__r   r   r   r"   r$   Úpropertyr    r   Zread_only_propertyr   r   r   r   r   r   
   s   *
r   N)Ú
__future__r   r   r   Zcryptographyr   Úobjectr   r   r   r   r   Ú<module>   s   