Commit e132f0dd authored by Ramon Nou's avatar Ramon Nou
Browse files

Updated generate.py example

parent db0919c9
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -10,14 +10,14 @@

#  SPDX-License-Identifier: MIT
###

#!/usr/bin/python3
import re
import sys
import collections

file = sys.argv[1]

pattern = re.compile(r".+(read )(.*)( host: )(\d+).+(path: )(.+),.+(chunk_start: )(\d+).+(chunk_end: )(\d+)")
pattern = re.compile(r".+(read\ )(.*)( host: )(\d+).+(path: )(.+),.+(chunk_start: )(\d+).+(chunk_end: )(\d+)")

d = collections.OrderedDict()

@@ -25,7 +25,7 @@ with open(file) as f:
    for line in f:
        result = pattern.match(line)
        if result:
            d[result[2]] = 1
            d[result.group(2)] = 1
keys = sorted(d.keys())
i = 0
for key in keys:
@@ -36,5 +36,5 @@ with open(file) as f:
    for line in f:
        result = pattern.match(line)
        if result:
            for i in range(int(result[8]), int(result[10])+1):
                print (result[6], i, d[result[2]])
            for i in range(int(result.group(8)), int(result.group(10))+1):
                print (result.group(6), i, d[result.group(2)])