³ò
šõÜNc           @   sk   d  Z  d d k Z d d k l Z d d k l Z d e f d „  ƒ  YZ e ƒ  Z d e	 f d „  ƒ  YZ
 d S(	   sj   
$Rev: 592 $
$LastChangedBy: satoon101 $
$LastChangedDate: 2011-11-22 16:20:03 -0500 (Tue, 22 Nov 2011) $
iÿÿÿÿN(   t   delayed(   t   LoadedAddonst   _DependentAddonsc           B   sD   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s7   Class to store all dependent addons and their dependeesc         C   s   t  ƒ  |  _ d S(   s#   Called when the instance is createdN(   t   sett   recently_added(   t   self(    (    sZ   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/dependency.pyt   __init__   s    c         C   sk   | |  j o t  t |  ƒ i | ƒ Sn t | t j ƒ } |  | <|  i i | ƒ t d |  i i | ƒ | S(   s>   Gets the addon's instance and adds it if not in the dictionaryg{®Gáz„?(	   t   superR   t   __getitem__t   _DependencyR   R   t   addR    t   discard(   R   t   dependeet   value(    (    sZ   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/dependency.pyR   #   s    c         C   s>   | t  j o t i | d ƒ n t t |  ƒ i | | ƒ d S(   s+   Adds the addon's instance to the dictionaryi   N(   R   t   esR   R   R   t   __setitem__(   R   t   addonR   (    (    sZ   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/dependency.pyR   9   s    c         C   sM   | |  j o< |  | i  p t i | d ƒ n t t |  ƒ i | ƒ n d S(   s%   Removes the addon from the dictionaryi    N(   t   remain_loadedR   R   R   R   t   __delitem__(   R   R   (    (    sZ   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/dependency.pyR   E   s    c         C   s   |  | i  | ƒ d S(   s7   Adds a dependent addon to an addon that it depends uponN(   R
   (   R   R   t   depender(    (    sZ   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/dependency.pyt   _add_dependencyT   s    c         C   sy   | |  j o t  d | ƒ ‚ n | |  | j o t d | d | ƒ ‚ n |  | i | ƒ |  | p |  | =n d S(   s<   Removes a dependent addon from an addon that it depends upons   "%s" is not a dependents   "%s" s#   is not listed a a depender for "%s"N(   t   KeyErrort
   ValueErrorR   (   R   R   R   (    (    sZ   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/dependency.pyt   _remove_dependencyZ   s    
(	   t   __name__t
   __module__t   __doc__R   R   R   R   R   R   (    (    (    sZ   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/dependency.pyR      s   					R	   c           B   s   e  Z d  Z d „  Z RS(   sS   
    Class to hold a set of addons that are depended upon by the another addon
    c         C   s   | |  _  d S(   s$   Called when the class is initializedN(   R   (   R   R   (    (    sZ   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/dependency.pyR   |   s    (   R   R   R   R   (    (    (    sZ   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/dependency.pyR	   w   s   (   R   R   t
   gamethreadR    t   loadedR   t   dictR   t   DependentAddonsR   R	   (    (    (    sZ   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/dependency.pys   <module>   s   Z	