Commit c5bdc567 authored by Dominik Rimpf's avatar Dominik Rimpf

ADD: New helper functions

parent 619a465c
Pipeline #112206 failed with stage
in 16 seconds
......@@ -18,7 +18,19 @@ class ArgumentParser(argparse.ArgumentParser):
self.add_argument('--api-version', default=default_api_version,
help='webapi version')
def parse_args(self):
args = super(ArgumentParser, self).parse_args()
def parse_args(self, args=None, namespace=None):
args = super(ArgumentParser, self).parse_args(args, namespace)
return args
def dict_by_value_of_list(array, value):
return ((item[value], item) for item in array)
def dict_of_lists_by_value_of_list(array, value):
res = {}
for item in array:
if not item[value] in res:
res[item[value]] = []
res[item[value]].append(item)
return res
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment