a
    ¨ˆc|  ã                   @   s0   d Z ddlmZmZmZmZ G dd„ deƒZdS )ú> The representation of a name-to-object binding in a context. é    )ÚAnyÚ	HasTraitsÚPropertyÚStrc                       sX   e Zd ZdZeeƒZeZeZ	eZ
eeƒZeZ‡ fdd„Zdd„ Zdd„ Zdd	„ Z‡  ZS )
ÚBindingr   c                    s   t t| ƒ ¡ d| j| jf  S )z: Returns an informal string representation of the object. z(name=%s, obj=%s))Úsuperr   Ú__str__ÚnameÚobj)Úself©Ú	__class__© úZ/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/apptools/naming/binding.pyr	   6   s    þzBinding.__str__c                 C   s:   t | jƒdkr6| jdu rd}n| jj}d|j|jf }|S )z' Returns the class name of the object. r   Nz%s.%s)ÚlenÚ_class_namer   r   Ú
__module__Ú__name__)r   Ú
class_nameÚklassr   r   r   Ú_get_class_nameE   s    
zBinding._get_class_namec                 C   s
   || _ dS )z$ Sets the class name of the object. N)r   )r   r   r   r   r   Ú_set_class_nameS   s    zBinding._set_class_namec                 C   s>   | j dur| j j}nd}t|ƒdkr4|d | j }n| j}|S )z; Returns the name of the context within its own namespace. NÚ r   ú/)ÚcontextÚnamespace_namer   r
   )r   Úbaser   r   r   r   Ú_get_namespace_nameY   s    

zBinding._get_namespace_name)r   r   Ú__qualname__Ú__doc__r   r   r   r
   r   r   r   r   r   r	   r   r   r   Ú__classcell__r   r   r   r   r      s   r   N)r    Z
traits.apir   r   r   r   r   r   r   r   r   Ú<module>
   s   