Ñò
ãdØKc           @   s    d  d k  l Z l Z d  d k Z d  d k Z d e i f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ	 d	 e f d
 „  ƒ  YZ
 d d d „  ƒ  YZ d S(   iÿÿÿÿ(   t
   deprecatedt	   LOG_DEBUGNt   EnumExceptionc           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    s   scripts/common/enumerations.pyR      s   t   EnumItemc           B   s5   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         O   s   | |  _  | |  _ d  S(   N(   t   _EnumItem__namet   _EnumItem__index(   t   selft   namet   indext   argst   kwargs(    (    s   scripts/common/enumerations.pyt   __init__   s    	c         C   s   |  i  S(   N(   R   (   R   (    (    s   scripts/common/enumerations.pyR
      s    c         C   s   |  i  S(   N(   R   (   R   (    (    s   scripts/common/enumerations.pyR	      s    c         C   s
   |  i  ƒ  S(   N(   R	   (   R   (    (    s   scripts/common/enumerations.pyt   __repr__   s    c         C   s0   | o) |  i  | i ƒ  j o |  i | i ƒ  j S(   N(   R   R	   R   R
   (   R   t   other(    (    s   scripts/common/enumerations.pyt   __eq__   s    (   R   R   R   R
   R	   R   R   (    (    (    s   scripts/common/enumerations.pyR      s
   				t   CallabbleEnumItemc           B   s   e  Z d  „  Z d „  Z RS(   c         O   s/   t  t |  ƒ i | | | | | � | |  _ d  S(   N(   t   superR   R   t   _CallabbleEnumItem__function(   R   R	   R
   t   funcR   R   (    (    s   scripts/common/enumerations.pyR      s    "c         O   s   |  i  | | �  S(   N(   R   (   R   R   R   (    (    s   scripts/common/enumerations.pyt   __call__   s    (   R   R   R   R   (    (    (    s   scripts/common/enumerations.pyR      s   	t   AttributeEnumItemc           B   s&   e  Z d  „  Z d d „ Z d „  Z RS(   c         O   s/   t  t |  ƒ i | | | | | � | |  _ d  S(   N(   R   R   R   t   _AttributeEnumItem__data(   R   R	   R
   t   dataR   R   (    (    s   scripts/common/enumerations.pyR   !   s    "c         C   s   |  i  i | | ƒ S(   N(   R   t   get(   R   t   attrt   defval(    (    s   scripts/common/enumerations.pyR   %   s    c         C   s;   |  i  i | ƒ p t d d i |  i  ƒ ‚ n |  i  | S(   Ns
   Must be %ss   , (   R   t   has_keyt   AttributeErrort   join(   R   R   (    (    s   scripts/common/enumerations.pyt   __getattr__(   s    N(   R   R   R   t   NoneR   R   (    (    (    s   scripts/common/enumerations.pyR       s   	t   Enumerationc           B   sS   e  Z e d  „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(   c   	         sµ   | |  _  h  ‰ h  ‰ g  ‰  ‡ ‡  ‡ ‡ f d †  } t | t ƒ o. xY | i ƒ  D] \ } } | | | ƒ qP Wn/ d } x% | D] } | | | ƒ | d } q~ Wˆ |  _ ˆ |  _ d  S(   Nc            sç   t  | ƒ t i j o | d d !\ } n | } t  | ƒ t i j o t d | ‚ n | ˆ j o t d | ‚ n |  ˆ j o t d |  f ‚ n ˆ i | ƒ | |  f t | d ƒ } ˆ  | Œ  } | ˆ | <| ˆ | i ƒ  <d  S(   Ni    i   s   enum name is not a string: s   enum name is not unique: s   index %s is not unique: (   t   typet   typest	   TupleTypet
   StringTypeR   t   appendt   tupleR
   (   t   idxt   enumItemt   xR   t   item(   t   instancet   uniqueNamest   lookupt	   idxLookup(    s   scripts/common/enumerations.pyt   appendEnumItem5   s    
i    i   (   t   __doc__t
   isinstancet   dictt   itemst   _Enumeration__lookupt   _Enumeration__idxLookup(	   R   R	   t   enumListR,   R0   R(   R)   t   it   e(    (   R-   R,   R.   R/   s   scripts/common/enumerations.pyR   /   s     	  	c         C   s>   | |  i  j o# t d | d i |  i  ƒ f ‚ n |  i  | S(   Ns   Attr '%s' must be in (%s)s   , (   R5   R   R   (   R   R   (    (    s   scripts/common/enumerations.pyR   S   s    #c         C   s   |  i  i | d  ƒ S(   N(   R6   R   R    (   R   R(   (    (    s   scripts/common/enumerations.pyt   __getitem__X   s    c         C   s   t  |  i ƒ S(   N(   t   iterR5   (   R   (    (    s   scripts/common/enumerations.pyt   __iter__[   s    c         C   s   |  i  i ƒ  S(   N(   R5   t   values(   R   (    (    s   scripts/common/enumerations.pyt   all^   s    c         C   s   |  i  i ƒ  S(   N(   R5   t   keys(   R   (    (    s   scripts/common/enumerations.pyR?   a   s    c         C   s   |  i  | ƒ S(   N(   R   (   R   R	   (    (    s   scripts/common/enumerations.pyt   ofd   s    c         C   s   |  i  i | d  ƒ S(   N(   R5   R   R    (   R   R	   (    (    s   scripts/common/enumerations.pyR.   g   s    (   R   R   R   R   R   R:   R<   R>   R?   R@   R.   (    (    (    s   scripts/common/enumerations.pyR!   -   s   $						(    (   t   debug_utilsR    R   R#   t
   exceptionst	   ExceptionR   t   objectR   R   R   R!   (    (    (    s   scripts/common/enumerations.pyt   <module>   s   