Esempio n. 1
0
    def __get__(self, instance, owner):
        hist =  StatError.__get__(self, instance, owner)

        # check if errors should be added to the histogram
        if (instance.type in self.mc_channels and
            getattr(instance, self.__variable_name)):

            self.add_error(hist)

            setattr(instance, self.__variable_name, False)

        return hist
    def __set__(self, instance, value):
        StatError.__set__(self, instance, value)

        # mark MC channel
        if instance.type in self.mc_channels:
            setattr(instance, self.__variable_name, True)
 def __init__(self, percent):
     StatError.__init__(self, percent)
     self.__variable_name = "__{0:x}".format(random.getrandbits(32))