a
    á `š
  ã                   @   s@   d Z G dd„ deƒZG dd„ deƒZG dd„ deƒZdd„ Zd	S )
z0Useful mixins for Challenge and Resource objectsc                       s:   e Zd ZdZedd„ ƒZejdd„ ƒZ‡ fdd„Z‡  ZS )ÚVersionedLEACMEMixinzEThis mixin stores the version of Let's Encrypt's endpoint being used.c                 C   s   t | ddƒS )z*Define the version of ACME protocol to useÚ_le_acme_versioné   )Úgetattr©Úself© r   ú-/usr/lib/python3/dist-packages/acme/mixins.pyÚle_acme_version   s    z$VersionedLEACMEMixin.le_acme_versionc                 C   s   t  | d|¡ d S )Nr   )ÚobjectÚ__setattr__)r   Úversionr   r   r   r	      s    c                    s.   |dkrt  | ||¡ ntt| ƒ ||¡ d S )Nr	   )r
   r   Úsuperr   )r   ÚkeyÚvalue©Ú	__class__r   r   r      s    z VersionedLEACMEMixin.__setattr__)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úpropertyr	   Úsetterr   Ú__classcell__r   r   r   r   r      s   

r   c                       s,   e Zd ZdZ‡ fdd„Z‡ fdd„Z‡  ZS )ÚResourceMixinz…
    This mixin generates a RFC8555 compliant JWS payload
    by removing the `resource` field if needed (eg. ACME v2 protocol).
    c                    s   t tt| ƒddƒS )ú/See josepy.JSONDeserializable.to_partial_json()Úto_partial_jsonÚresource©Ú_safe_jobj_compliancer   r   r   r   r   r   r      s    
ÿzResourceMixin.to_partial_jsonc                    s   t tt| ƒddƒS )ú8See josepy.JSONObjectWithFields.fields_to_partial_json()Úfields_to_partial_jsonr   r   r   r   r   r   r    $   s    
ÿz$ResourceMixin.fields_to_partial_json©r   r   r   r   r   r    r   r   r   r   r   r      s   r   c                       s,   e Zd ZdZ‡ fdd„Z‡ fdd„Z‡  ZS )Ú	TypeMixinzŒ
    This mixin allows generation of a RFC8555 compliant JWS payload
    by removing the `type` field if needed (eg. ACME v2 protocol).
    c                    s   t tt| ƒddƒS )r   r   Útype©r   r   r"   r   r   r   r   r   /   s    
ÿzTypeMixin.to_partial_jsonc                    s   t tt| ƒddƒS )r   r    r#   r$   r   r   r   r   r    4   s    
ÿz TypeMixin.fields_to_partial_jsonr!   r   r   r   r   r"   *   s   r"   c                 C   sB   t | |ƒr0t| |ƒƒ }| jdkr,| |d ¡ |S td |¡ƒ‚d S )Né   z Method {0}() is not implemented.)Úhasattrr   r	   ÚpopÚAttributeErrorÚformat)ÚinstanceZjobj_methodZuncompliant_fieldZjobjr   r   r   r   :   s    

r   N)r   r
   r   r   r"   r   r   r   r   r   Ú<module>   s   