Commit e48924d2 authored by Dominik Rimpf's avatar Dominik Rimpf
Browse files

UPD: Better method names

parent b322d327
Pipeline #112485 passed with stage
in 22 seconds
...@@ -23,14 +23,14 @@ class ArgumentParser(argparse.ArgumentParser): ...@@ -23,14 +23,14 @@ class ArgumentParser(argparse.ArgumentParser):
return args return args
def dict_by_value_of_list(array, value): def list_to_generator_map_one2one(array, value):
"""Mapping function to convert list of dicts to an dict with value as key for each dict. (1 to 1 Mapping) """Mapping function to convert list of dicts to an mapping with value as key for each dict. (1 to 1 Mapping)
Returns an generator object.""" Returns an generator object."""
return ((item[value], item) for item in array) return ((item[value], item) for item in array)
def dict_of_lists_by_value_of_list(array, value): def list_to_generator_map_one2many(array, value):
"""Mapping function to convert list of dicts to an dict with values as key for each lists. (1 to n Mapping) """Mapping function to convert list of dicts to an mapping with values as key for each lists. (1 to n Mapping)
Returns an generator object.""" Returns an generator object."""
res = {} res = {}
for item in array: for item in array:
......
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