Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. class Traits(object):
  2.    
  3.     def __init__(self):
  4.        
  5.         self.list = {}
  6.        
  7.     def Incr(self, trait):
  8.    
  9.         if trait in self.list:
  10.             self.list[trait] += 1
  11.         else:
  12.             self.list[trait] = 1
  13.            
  14.     def Decr(self, trait):
  15.        
  16.         if trait in self.list:
  17.             self.list[trait] -= 1
  18.         else:
  19.             self.list[trait] = -1
  20.            
  21.     def Adjust(self, trait, amt):
  22.        
  23.         if trait in self.list:
  24.             self.list[trait] += amt
  25.         else:
  26.             self.list[trait] = amt
  27.            
  28.     def Set(self, trait, amt):
  29.        
  30.         self.list[trait] = amt
  31.        
  32.     def Get(self, trait):
  33.        
  34.         if trait in self.list:
  35.             return self.list[trait]
  36.         else:
  37.             return 0