예제 #1
0
 def comparator(cls, et, et_list):
     etype = et.get_type()
     if etype in et_list:
         # if the type being compared is in the orderList, return it's position
         return et_list.index(etype)
     # otherwise return a value greater than the last position of the orderList
     return len(et_list)+1
예제 #2
0
 def get(self, etype):
     for et in self:
         if et.get_type() == etype:
             return et
     return None
예제 #3
0
 def __getattr__(self, etype):
     for et in self:
         if et.get_type() == etype:
             return et
     raise EnumeratedTypeError("unable to find %s" % str(etype))