move function
This commit is contained in:
parent
dad9d297ab
commit
0fe5fa5536
1 changed files with 7 additions and 6 deletions
|
|
@ -8,13 +8,14 @@ class Rule(NamedTuple):
|
||||||
parent: str
|
parent: str
|
||||||
|
|
||||||
|
|
||||||
def sort_by_rules(in_list: list, rules: list[Rule]) -> bool:
|
|
||||||
def is_rule_satisfied(in_list: list, rule: Rule) -> bool:
|
def is_rule_satisfied(in_list: list, rule: Rule) -> bool:
|
||||||
child_val, parent_val = rule
|
child_val, parent_val = rule
|
||||||
child_index = in_list.index(child_val)
|
child_index = in_list.index(child_val)
|
||||||
parent_index = in_list.index(parent_val)
|
parent_index = in_list.index(parent_val)
|
||||||
return parent_index < child_index
|
return parent_index < child_index
|
||||||
|
|
||||||
|
|
||||||
|
def sort_by_rules(in_list: list, rules: list[Rule]) -> bool:
|
||||||
def move_item_down(in_list: list, index: int):
|
def move_item_down(in_list: list, index: int):
|
||||||
"""moves item"""
|
"""moves item"""
|
||||||
# assert index >
|
# assert index >
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue