def parseEventRange(self, trace, eventRange):
    if not eventRange:
      return (0, len(trace.events))
    
    def parse(number, base = 0, default = 0):
      if not number:
        return default
      
      if number[0] == '+':
        offset = base
        number = number[1:]
      else:
        offset = 0
        
      try:
        return int(number) + offset
      except ValueError:
        assert number[0] == "#"
        targetFrameNumber = int(number[1:])
        frameNumber       = 0
        
        if targetFrameNumber < 0:
          frames = len([e for e in trace.events if self.lookupFunction(e).isFrameMarker])
          targetFrameNumber += frames
        
        i = 0
        for i, event in enumerate(trace.events[offset:]):
          if frameNumber == targetFrameNumber:
            break
          if self.lookupFunction(event).isFrameMarker:
            frameNumber += 1
        return i + offset
    
    try:
      first, last = eventRange.split(":")
    except ValueError:
      first, last = eventRange, eventRange
      
    first = parse(first)
    last  = parse(last, first, len(trace.events))
    if first == last: last += 1
    return (first, last)
Convert an event range description string into a concrete event range for a trace.
dataset/ETHPy150Open skyostil/tracy/src/analyzer/Analyzer.py/InteractiveAnalyzer.parseEventRange