Skip to content
Snippets Groups Projects
Commit 2019194a authored by Felix Kleinert's avatar Felix Kleinert
Browse files

update pop_list fuction to behave like dict_pop

parent a3f714b7
No related branches found
No related tags found
3 merge requests!90WIP: new release update,!89Resolve "release branch / CI on gpu",!84Felix issue080 testing test helpers
...@@ -201,19 +201,17 @@ def float_round(number: float, decimals: int = 0, round_type: Callable = math.ce ...@@ -201,19 +201,17 @@ def float_round(number: float, decimals: int = 0, round_type: Callable = math.ce
return round_type(number * multiplier) / multiplier return round_type(number * multiplier) / multiplier
def dict_pop(dict: Dict, pop_keys):
pop_keys = to_list(pop_keys)
return {k: v for k, v in dict.items() if k not in pop_keys}
def list_pop(list_full: list, pop_items): def list_pop(list_full: list, pop_items):
pop_items = to_list(pop_items) pop_items = to_list(pop_items)
if len(pop_items) > 1: if len(pop_items) > 1:
return [e for e in list_full if e not in pop_items] return [e for e in list_full if e not in pop_items]
else: else:
list_pop = list_full.copy() l_pop = list_full.copy()
list_pop.remove(pop_items[0]) try:
return list_pop l_pop.remove(pop_items[0])
except ValueError:
pass
return l_pop
def dict_pop(dict_orig: Dict, pop_keys): def dict_pop(dict_orig: Dict, pop_keys):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment