
    fh                     F    d dl Z  G d de          Z G d de          ZdS )    Nc                   ,     e Zd ZdZ fdZ fdZ xZS )	Singletonz
    Singleton metaclass
    Based on Python Cookbook 3rd Edition Recipe 9.13
    Only one instance of a class can exist. Does not work with __slots__
    c                 H     t                      j        |i | d | _        d S N)super__init___Singleton__instanceselfargskw	__class__s      P/var/www/histauto/venv/lib/python3.11/site-packages/openpyxl/compat/singleton.pyr   zSingleton.__init__   s*    $%"%%%    c                 \    | j          t                      j        |i || _         | j         S r   )r	   r   __call__r
   s      r   r   zSingleton.__call__   s0    ?".egg.;;;DOr   __name__
__module____qualname____doc__r   r   __classcell__r   s   @r   r   r      s[                     r   r   c                   ,     e Zd ZdZ fdZ fdZ xZS )Cachedz
    Caching metaclass
    Child classes will only create new instances of themselves if
    one doesn't already exist. Does not work with __slots__
    c                 j     t                      j        |i | t          j                    | _        d S r   )r   r   weakrefWeakValueDictionary_Cached__cacher
   s      r   r   zCached.__init__   s3    $%"%%%244r   c                 t    || j         v r| j         |         S  t                      j        | }|| j         |<   |S r   )r   r   r   )r   r   objr   s      r   r   zCached.__call__"   sA    4<<%%egg% T
r   r   r   s   @r   r   r      s[         5 5 5 5 5        r   r   )r   typer   r    r   r   <module>r$      sn           "    T     r   