U
    æ¥¡cü	  ã                   @   s~   d dl Z d dlmZ ddlmZ dgZd dlmZmZm	Z	m
Z
mZ d dlmZ erjd dlmZ d d	lmZ G d
d„ deƒZdS )é    N)Ú	join_pathé   )ÚHeadÚRemoteReference)ÚAnyÚIteratorÚNoReturnÚUnionÚTYPE_CHECKING)ÚPathLike)ÚRepo)ÚRemotec                	       sz   e Zd ZdZejZeddee	df ed e
e
ed  dœ‡ fdd„ƒZedd e
ddœd	d
„ƒZee
e
edœdd„ƒZ‡  ZS )r   z1Represents a reference pointing to a remote head.Nr   )r   N)ÚrepoÚcommon_pathÚremoteÚargsÚkwargsÚreturnc                    s2   |p| j }|dk	r t|t|ƒƒ}tt| ƒ ||¡S )zKIterate remote references, and if given, constrain them to the given remoteN)Ú_common_path_defaultr   ÚstrÚsuperr   Ú
iter_items)Úclsr   r   r   r   r   ©Ú	__class__© ú3/tmp/pip-unpacked-wheel-_pbxsds5/git/refs/remote.pyr      s    

zRemoteReference.iter_items)r   Úrefsr   r   c              	   O   s‚   |j jd|žŽ  |D ]h}zt tj |j|j¡¡ W n tk
rH   Y nX zt tj |j|j¡¡ W q tk
rz   Y qX qdS )z¯Delete the given remote references

        :note:
            kwargs are given for comparability with the base class method as we
            should not narrow the signature.ú-dú-rN)r   r   )	ÚgitÚbranchÚosÚremoveÚpathÚjoinZ
common_dirÚOSErrorÚgit_dir)r   r   r   r   Úrefr   r   r   Údelete2   s    zRemoteReference.delete)r   r   r   c                 O   s   t dƒ‚dS )zUsed to disable this methodz*Cannot explicitly create remote referencesN)Ú	TypeError)r   r   r   r   r   r   ÚcreateH   s    zRemoteReference.create)NN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Z_remote_common_path_defaultr   Úclassmethodr	   r   r   r   r   r)   r   r+   Ú__classcell__r   r   r   r   r      s"     ü
ù)r"   Zgit.utilr   Úheadr   Ú__all__Útypingr   r   r   r	   r
   Z	git.typesr   Zgit.repor   r    r   r   r   r   r   r   Ú<module>   s   