def make_match_string(key, to_code): codes = datafile.key_to_code(key, to_code) if codes is None: codes = [] if not isinstance(codes, (tuple, list)): codes = [codes, ] return ' | '.join(['(code == %i)' % c for c in codes])
def make_match_string(key, to_code): codes = datafile.key_to_code(key, to_code) if codes is None: codes = [] if not isinstance(codes, (tuple, list)): codes = [ codes, ] return ' | '.join(['(code == %i)' % c for c in codes])
def get_events(self, key=None, time_range=None): kt, tt = make_tests(key, time_range, self.to_code) if key is None: codes = self.eventbuffer.keys() else: codes = key_to_code(key, self.to_code) if not isinstance(codes, (tuple, list)): codes = [codes, ] events = [] for code in codes: for e in self.eventbuffer[code]: if tt(e): events.append(e) return events