Пример #1
0
    def start(self):
        # Note that this function must be kept separate from
        # NextOccurrencesEngine because it can be used without the latter (e.g.
        # by wxtasklist); note also that both functions generate their own
        # events
        self.occs = NextOccurrences()
        self.utcoffset = timeaux.UTCOffset()
        search_start = (time_.time(), time_.clock())

        try:
            for filename in self.filenames:
                if not self.base_time:
                    self.base_time = self.base_times[filename]

                # Don't even think of moving this to the constructor, as
                # self.base_time could be defined just above
                utcbase = self.base_time - self.utcoffset.compute(
                    self.base_time)

                for row in organism_api.get_all_valid_item_rules(filename):
                    id_ = row['R_id']
                    rules = organism_api.convert_string_to_rules(
                        row['R_rules'])

                    for rule in rules:
                        self._search_item(filename, id_, rule, utcbase)

                get_next_occurrences_event.signal(base_time=self.base_time,
                                                  filename=filename,
                                                  occs=self.occs)

        # All loops must be broken
        except NextOccurrencesSearchStop:
            pass

        log.debug('Next occurrences found in {} (time) / {} (clock) s'.format(
            time_.time() - search_start[0],
            time_.clock() - search_start[1]))
Пример #2
0
    def start(self):
        # Note that this function must be kept separate from
        # NextOccurrencesEngine because it can be used without the latter (e.g.
        # by wxtasklist); note also that both functions generate their own
        # events
        self.occs = NextOccurrences()
        self.utcoffset = timeaux.UTCOffset()
        search_start = (time_.time(), time_.clock())

        try:
            for filename in self.filenames:
                if not self.base_time:
                    self.base_time = self.base_times[filename]

                # Don't even think of moving this to the constructor, as
                # self.base_time could be defined just above
                utcbase = self.base_time - self.utcoffset.compute(
                                                                self.base_time)

                for row in organism_api.get_all_valid_item_rules(filename):
                    id_ = row['R_id']
                    rules = organism_api.convert_string_to_rules(
                                                                row['R_rules'])

                    for rule in rules:
                        self._search_item(filename, id_, rule, utcbase)

                get_next_occurrences_event.signal(base_time=self.base_time,
                                            filename=filename, occs=self.occs)

        # All loops must be broken
        except NextOccurrencesSearchStop:
            pass

        log.debug('Next occurrences found in {} (time) / {} (clock) s'.format(
                                              time_.time() - search_start[0],
                                              time_.clock() - search_start[1]))
Пример #3
0
 def _update_all_items(self):
     for row in organism_api.get_all_item_rules(self.filename):
         id_ = row['R_id']
         rules = organism_api.convert_string_to_rules(row['R_rules'])
         self._update_item(id_, rules)
Пример #4
0
 def _update_all_items(self):
     for row in organism_api.get_all_item_rules(self.filename):
         id_ = row['R_id']
         rules = organism_api.convert_string_to_rules(row['R_rules'])
         self._update_item(id_, rules)