ó
•‰]c           @@  sL   d  d l  m Z d  d l Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d S(   i    (   t   absolute_importNt	   Singletonc           B@  s    e  Z d  Z d „  Z d „  Z RS(   s›   
    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         O@  s&   t  t |  ƒ j | | Ž  d  |  _ d  S(   N(   t   superR   t   __init__t   Nonet   _Singleton__instance(   t   selft   argst   kw(    (    s8   lib/python2.7/site-packages/openpyxl/compat/singleton.pyR      s    c         O@  s7   |  j  d  k r0 t t |  ƒ j | | Ž  |  _  n  |  j  S(   N(   R   R   R   R   t   __call__(   R   R   R   (    (    s8   lib/python2.7/site-packages/openpyxl/compat/singleton.pyR	      s    !(   t   __name__t
   __module__t   __doc__R   R	   (    (    (    s8   lib/python2.7/site-packages/openpyxl/compat/singleton.pyR      s   	t   Cachedc           B@  s    e  Z d  Z d „  Z d „  Z RS(   s™   
    Caching metaclass
    Child classes will only create new instances of themselves if
    one doesn't already exist. Does not work with __slots__
    c         O@  s,   t  t |  ƒ j | | Ž  t j ƒ  |  _ d  S(   N(   R   R   R   t   weakreft   WeakValueDictionaryt   _Cached__cache(   R   R   R   (    (    s8   lib/python2.7/site-packages/openpyxl/compat/singleton.pyR      s    c         G@  sC   | |  j  k r |  j  | St t |  ƒ j | Œ  } | |  j  | <| S(   N(   R   R   R   R	   (   R   R   t   obj(    (    s8   lib/python2.7/site-packages/openpyxl/compat/singleton.pyR	   #   s
    (   R
   R   R   R   R	   (    (    (    s8   lib/python2.7/site-packages/openpyxl/compat/singleton.pyR      s   	(   t
   __future__R    R   t   typeR   R   (    (    (    s8   lib/python2.7/site-packages/openpyxl/compat/singleton.pyt   <module>   s   