³ò
á@Oc           @   sE   d  Z  d d k l Z e d ƒ Z d e f d „  ƒ  YZ e ƒ  Z d S(   sj   
$Rev: 617 $
$LastChangedBy: satoon101 $
$LastChangedDate: 2012-01-23 13:23:59 -0500 (Mon, 23 Jan 2012) $
iÿÿÿÿ(   t   get_game_dirs%   addons/eventscripts/gungame51/scriptst   _ValidAddonsc           B   sY   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z e d „  ƒ Z	 e
 d „  ƒ Z RS(   s7   Class used to get/store all valid addons and their typec         C   s4   |  i  d ƒ |  _ |  i  d ƒ i |  i ƒ |  _ d S(   s;   Gets all addons if the class has not already be initializedt   includedt   customN(   t   _get_addons_by_typeR   t
   differenceR   (   t   self(    (    sU   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/valid.pyt   __init__   s    c         C   s   |  i  | ƒ S(   s3   Redirects to __getitem__ since this is a dictionary(   t   __getitem__(   R   t   attr(    (    sU   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/valid.pyt   __getattr__(   s    c         C   s   |  i  | | ƒ d S(   s3   Redirects to __setitem__ since this is a dictionaryN(   t   __setitem__(   R   R	   t   value(    (    sU   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/valid.pyt   __setattr__.   s    c         C   s:   | d j o t  d ƒ ‚ n t t |  ƒ i | | ƒ d S(   sY   
            Makes sure that only included and custom are keys to the dictionary
        R   R   s)   Key must be either "included" or "custom"N(   s   includeds   custom(   t   KeyErrort   superR   R   (   R   t   itemR   (    (    sU   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/valid.pyR   4   s    c         C   s>   x' |  D] } | |  | j o | Sq q Wt  d | ƒ ‚ d S(   s0   Returns the "type" of addon (included or custom)s   "%s" is not a valid addonN(   t
   ValueError(   R   t   addont
   addon_type(    (    sU   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/valid.pyt   get_addon_typeB   s
     c         C   s   |  i  i |  i ƒ S(   s!   Returns a set of all valid addons(   R   t   unionR   (   R   (    (    sU   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/valid.pyt   allQ   s    c         C   s7   t  g  } t i |  ƒ i ƒ  D] } | | i q ~ ƒ S(   s4   Returns a set of all valid addons for the given type(   t   sett   _main_addon_patht   joinpatht   dirst   namebase(   R   t   _[1]R   (    (    sU   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/valid.pyR   X   s    
(   t   __name__t
   __module__t   __doc__R   R
   R   R   R   t   propertyR   t   staticmethodR   (    (    (    sU   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/valid.pyR      s   					N(   R   t   gungame51.coreR    R   t   dictR   t   ValidAddons(    (    (    sU   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/valid.pys   <module>   s   G