U
    çe¨]‚  ã                   @   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 ]<}z| t|dƒ¡ W q tk
rT   td| j  ƒ‚Y qX qt|ƒdk rrtd| j  ƒ‚|d dkrŒtd| j  ƒ‚|d dk r²|d dkr²td	| j  ƒ‚d S )
NÚ.r   z%Malformed OID: %s (non-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ÚappendÚintÚ
ValueErrorÚlen)ÚselfÚdotted_stringZnodesZintnodesZnode© r   ú:/usr/lib/python3/dist-packages/cryptography/hazmat/_oid.pyÚ__init__   s<    ÿÿÿÿÿÿÿÿzObjectIdentifier.__init__c                 C   s   t |tƒstS | j|jkS ©N)Ú
isinstancer   ÚNotImplementedr   ©r   Úotherr   r   r   Ú__eq__+   s    
zObjectIdentifier.__eq__c                 C   s
   | |k S r   r   r   r   r   r   Ú__ne__1   s    zObjectIdentifier.__ne__c                 C   s   d  | j| j¡S )Nz#<ObjectIdentifier(oid={}, name={})>)Úformatr   Ú_name©r   r   r   r   Ú__repr__4   s    þzObjectIdentifier.__repr__c                 C   s
   t | jƒS r   )Úhashr   r   r   r   r   Ú__hash__:   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   =   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)Z
__future__r   r   r   Zcryptographyr   Úobjectr   r   r   r   r   Ú<module>   s   