vregistry.py
branchtls-sprint
changeset 835 7dcb11dd443e
parent 827 3f08481e6e51
child 943 9fdfa8d38359
equal deleted inserted replaced
834:50d5ca1180b1 835:7dcb11dd443e
   693     def __init__(self, selector):
   693     def __init__(self, selector):
   694         self.selector = selector
   694         self.selector = selector
   695 
   695 
   696     def __call__(self, cls, *args, **kwargs):
   696     def __call__(self, cls, *args, **kwargs):
   697         score = self.selector(cls, *args, **kwargs)
   697         score = self.selector(cls, *args, **kwargs)
   698         return not score
   698         return int(not score)
   699 
   699 
   700     def __str__(self):
   700     def __str__(self):
   701         return 'NOT(%s)' % super(NotSelector, self).__str__()
   701         return 'NOT(%s)' % super(NotSelector, self).__str__()
   702 
   702 
   703 # advanced selector building functions ########################################
   703 
       
   704 # XXX bw compat functions #####################################################
   704 
   705 
   705 def chainall(*selectors, **kwargs):
   706 def chainall(*selectors, **kwargs):
   706     """return a selector chaining given selectors. If one of
   707     """return a selector chaining given selectors. If one of
   707     the selectors fail, selection will fail, else the returned score
   708     the selectors fail, selection will fail, else the returned score
   708     will be the sum of each selector'score
   709     will be the sum of each selector'score