mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-24 02:35:58 +01:00
start moving algorithm in
This commit is contained in:
40
userland/algorithm/set/parse_output
Executable file
40
userland/algorithm/set/parse_output
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import collections
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
|
||||
import common
|
||||
|
||||
data = common.LkmcOrderedDict()
|
||||
|
||||
# Parse
|
||||
|
||||
output = common.LkmcList()
|
||||
next(sys.stdin)
|
||||
for line in sys.stdin:
|
||||
line = line.rstrip()
|
||||
if line == '':
|
||||
break
|
||||
output.append(int(line))
|
||||
data['output'] = output
|
||||
|
||||
times = common.LkmcList()
|
||||
next(sys.stdin)
|
||||
for line in sys.stdin:
|
||||
line = line.rstrip()
|
||||
if line == '':
|
||||
break
|
||||
times.append(common.LkmcList([int(i) for i in line.split(' ')], oneline=True))
|
||||
data['times'] = times
|
||||
|
||||
# Handle CLI arguments.
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('key', nargs='?')
|
||||
args = parser.parse_args()
|
||||
if args.key:
|
||||
print(data[args.key])
|
||||
else:
|
||||
print(data)
|
||||
Reference in New Issue
Block a user