def __init__(self, max=None, interval=100, info=None, infoStr=None, automated=None, begin=True, label=None, display_initial_info=None, max_allowed=None, do_print=False, **kw): """ :type info : ActionInfo """ args = DictCaseInsensitive(kw, locals(), delete='kw infoStr info max self') simple_label = False self.counts = EvernoteCounter() self.__interval = interval self.__reported_progress = False if not isinstance(max, int): if hasattr(max, '__len__'): max = len(max) else: max = None self.counts.max = -1 if max is not None: self.counts.max = max args.max = self.counts.max if is_str(info): # noinspection PyTypeChecker info = ActionInfo(info, **args) elif infoStr and not info: info = ActionInfo(infoStr, **args) elif label and not info: simple_label = True if display_initial_info is None: display_initial_info = False info = ActionInfo(label, **args) elif label: info.Label = label if self.counts.max > 0 and info and (info.Max is None or info.Max < 1): info.Max = max self.counts.max_allowed = self.counts.max if max_allowed is None else max_allowed self.__did_break = True self.__do_print = do_print self.__info = info self.__action_initialized = False self.__action_attempted = self.hasActionInfo and (display_initial_info is not False) if self.__action_attempted: if self.info is None: log("Unexpected; Timer '%s' has no ActionInfo instance" % label, do_print=True) else: self.__action_initialized = self.info.displayInitialInfo(**args) is EvernoteAPIStatus.Initialized if begin: self.reset(False) log_blank(filename='counters') log(self.counts.fullSummary(self.name + ': Start'), 'counters')
def __init__(self, max=None, interval=100, info=None, infoStr=None, automated=None, begin=True, label=None, display_initial_info=None, max_allowed=None, do_print=False, **kw): """ :type info : ActionInfo """ args = DictCaseInsensitive(kw, locals(), delete='kw infoStr info max self') simple_label = False self.counts = EvernoteCounter() self.__interval = interval self.__reported_progress = False if not isinstance(max, int): if hasattr(max, '__len__'): max = len(max) else: max = None self.counts.max = -1 if max is not None: self.counts.max = max args.max = self.counts.max if is_str(info): # noinspection PyTypeChecker info = ActionInfo(info, **args) elif infoStr and not info: info = ActionInfo(infoStr, **args) elif label and not info: simple_label = True if display_initial_info is None: display_initial_info = False info = ActionInfo(label, **args) elif label: info.Label = label if self.counts.max > 0 and info and (info.Max is None or info.Max < 1): info.Max = max self.counts.max_allowed = self.counts.max if max_allowed is None else max_allowed self.__did_break = True self.__do_print = do_print self.__info = info self.__action_initialized = False self.__action_attempted = self.hasActionInfo and (display_initial_info is not False) if self.__action_attempted: if self.info is None: log("Unexpected; Timer '%s' has no ActionInfo instance" % label, do_print=True) else: self.__action_initialized = self.info.displayInitialInfo( **args) is EvernoteAPIStatus.Initialized if begin: self.reset(False) log_blank(filename='counters') log(self.counts.fullSummary(self.name + ': Start'), 'counters')