示例#1
0
 def Report(self, subcount_created=0, subcount_updated=0):
     str_tips = []
     self.counts.created.completed.subcount = subcount_created
     self.counts.updated.completed.subcount = subcount_updated
     str_tips += self.ReportSingle('were newly created',
                                   self.counts.created,
                                   self.info.str_value('created'))
     str_tips += self.ReportSingle('already exist and were updated',
                                   self.counts.updated,
                                   self.info.str_value('updated'))
     str_tips += self.ReportSingle('already exist but were unchanged',
                                   self.counts.skipped,
                                   process_subcounts=False)
     if self.counts.error:
         str_tips.append("%d Error(s) occurred " % self.counts.error.val)
     if self.status == EvernoteAPIStatus.ExceededLocalLimit:
         str_tips.append(
             "Action was prematurely terminated because locally-defined limit of %d was exceeded."
             % self.counts.max_allowed)
     report_title = "   > %s Complete" % self.info.Action
     if self.counts.total is 0:
         report_title += self.info.FormatLine(": No {r} were processed")
     show_report(report_title,
                 self.ReportHeader,
                 str_tips,
                 blank_line_before=False,
                 do_print=self.__do_print)
     log_blank('counters')
     log(self.counts.fullSummary(self.name + ': End'), 'counters')
示例#2
0
 def displayInitialInfo(self,
                        max=None,
                        interval=None,
                        automated=None,
                        enabled=None,
                        **kw):
     if max:
         self.__max = max
     if interval:
         self.__interval = interval
     if automated is not None:
         self.__automated = automated
     if enabled is not None:
         self.__enabled = enabled
     if self.emptyResults:
         if not self.Automated and self.__report_if_empty:
             log('report: ' + self.Aborted, self.Label)
             show_report(self.Aborted, blank_line_before=False)
         else:
             log('report: [automated] ' + self.Aborted, self.Label)
         return self.setStatus(EvernoteAPIStatus.EmptyRequest)
     if self.__enabled is False:
         log("Not starting - stopwatch.ActionInfo: enabled = false ",
             self.Label,
             do_print=self.__do_print)
         if not automated:
             show_report(self.ActionLine("Aborted",
                                         "Action has been disabled"),
                         blank_line_before=False)
         return self.setStatus(EvernoteAPIStatus.Disabled)
     log(self.Initiated, do_print=self.__do_print)
     self.BannerHeader()
     return self.setStatus(EvernoteAPIStatus.Initialized)
示例#3
0
 def displayInitialInfo(self, max=None, interval=None, automated=None, enabled=None, **kw):
     if max:
         self.__max = max
     if interval:
         self.__interval = interval
     if automated is not None:
         self.__automated = automated
     if enabled is not None:
         self.__enabled = enabled
     if self.emptyResults:
         if not self.Automated and self.__report_if_empty:
             log('report: ' + self.Aborted, self.Label)
             show_report(self.Aborted, blank_line_before=False)
         else:
             log('report: [automated] ' + self.Aborted, self.Label)
         return self.setStatus(EvernoteAPIStatus.EmptyRequest)
     if self.__enabled is False:
         log("Not starting - stopwatch.ActionInfo: enabled = false ", self.Label, do_print=self.__do_print)
         if not automated:
             show_report(self.ActionLine("Aborted", "Action has been disabled"),
                                       blank_line_before=False)
         return self.setStatus(EvernoteAPIStatus.Disabled)
     log(self.Initiated, do_print=self.__do_print)
     self.BannerHeader()
     return self.setStatus(EvernoteAPIStatus.Initialized)
示例#4
0
 def Report(self, subcount_created=0, subcount_updated=0):
     str_tips = []
     self.counts.created.completed.subcount = subcount_created
     self.counts.updated.completed.subcount = subcount_updated
     str_tips += self.ReportSingle('were newly created', self.counts.created, self.info.str_value('created'))
     str_tips += self.ReportSingle('already exist and were updated', self.counts.updated, self.info.str_value('updated'))
     str_tips += self.ReportSingle('already exist but were unchanged', self.counts.skipped, process_subcounts=False)
     if self.counts.error:
         str_tips.append("%d Error(s) occurred " % self.counts.error.val)
     if self.status == EvernoteAPIStatus.ExceededLocalLimit:
         str_tips.append("Action was prematurely terminated because locally-defined limit of %d was exceeded." %
                         self.counts.max_allowed)
     report_title = "   > %s Complete" % self.info.Action
     if self.counts.total is 0:
         report_title += self.info.FormatLine(": No {r} were processed")
     show_report(report_title, self.ReportHeader, str_tips, blank_line_before=False, do_print=self.__do_print)
     log_blank('counters')
     log(self.counts.fullSummary(self.name + ': End'), 'counters')