a
    �Ï?e  ã                   @   s   d Z ddlZG dd„ dƒZdS )zqSingleton class.

.. versionadded:: 0.9.8

   - Add to make a kind of manager instancne later to manage plugins.
é    Nc                   @   s$   e Zd ZdZdZe ¡ Zdd„ ZdS )Ú	SingletonzzSingleton utilizes __new__ special method.

    .. note:: Inherited classes are equated with base class inherit this.
    Nc                 C   sL   | j du rF| j�& | j du r(t | ¡| _ W d  ƒ n1 s<0    Y  | j S )z2Override class constructor to cache class objects.N)Ú_Singleton__instanceÚ_Singleton__lockÚobjectÚ__new__)Úcls© r   úV/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/anyconfig/singleton.pyr      s
    

*zSingleton.__new__)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú	threadingÚRLockr   r   r   r   r   r	   r      s   r   )r   r   r   r   r   r   r	   Ú<module>   s   