diff options
| -rwxr-xr-x | analysis0510.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/analysis0510.py b/analysis0510.py new file mode 100755 index 0000000..b51fc8c --- /dev/null +++ b/analysis0510.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +import argparse + + +def read_from_line(line: str) -> dict[str, int | float]: + ret = {} + if 'skip:' in line: + ret.update({'skip': int(line.split('skip:', 2)[1].split(',')[0])}) + ret.update({'sample': int(line.split('length:', 2)[1].split('|', 2)[0])}) + ret.update({'custom': float(line.split('custom time: ', 2)[1].split('time')[0])}) + ret.update({'normal': float(line.rsplit('time:', 2)[1])}) + return ret + + +def read(file: str) -> None: + items = {} + with open(file) as fin: + while s := fin.readline(): + element = read_from_line(s) + if (sample := element['sample']) not in items: + items.update({sample: []}) + items[sample].append(element) + print(items) + + +if __name__ == '__main__': + arg_ = argparse.ArgumentParser() + arg_.add_argument("file") + read(arg_.parse_args().file) |
