
    |f;                     8    d dl Z  G d de      Z G d de      Zy)    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                 :    t        t        | 
  |i | d | _        y N)superr   __init___Singleton__instanceselfargskw	__class__s      q/var/dept/share/cheung/public_html/OutSchool/python/env/lib/python3.12/site-packages/openpyxl/compat/singleton.pyr   zSingleton.__init__   s    i'44    c                 d    | j                   t        t        |   |i || _         | j                   S r   )r	   r   r   __call__r
   s      r   r   zSingleton.__call__   s/    ??"#It=tJrJDO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                 ^    t        t        | 
  |i | t        j                         | _        y r   )r   r   r   weakrefWeakValueDictionary_Cached__cacher
   s      r   r   zCached.__init__   s'    i'44224r   c                     || j                   v r| j                   |   S t        t        |   | }|| j                   |<   |S r   )r   r   r   r   )r   r   objr   s      r   r   zCached.__call__"   sB    4<<<<%%It-t4 T
r   r   r   s   @r   r   r      s    5 r   r   )r   typer   r    r   r   <module>r$      s"     "T r   