Skip to content

Commit

Permalink
Add args.recursive
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzie007 committed Aug 7, 2024
1 parent c607dc4 commit a26ad87
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 7 deletions.
5 changes: 4 additions & 1 deletion ikdsplit/filler.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ def run(args: argparse.Namespace) -> None:
"min_order": args.order,
"max_configurations": args.configurations,
}
start_recursive(fill, criteria)
if args.recursive:
start_recursive(fill, criteria)
else:
fill()


def main() -> None:
Expand Down
5 changes: 4 additions & 1 deletion ikdsplit/regressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ def run(args: argparse.Namespace) -> None:
"min_order": args.order,
"max_configurations": args.configurations,
}
start_recursive(regress, criteria)
if args.recursive:
start_recursive(regress, criteria)
else:
regress()


def main() -> None:
Expand Down
5 changes: 4 additions & 1 deletion ikdsplit/sorter.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ def run(args: argparse.Namespace) -> None:
"min_order": args.order,
"max_configurations": args.configurations,
}
start_recursive(sort, criteria)
if args.recursive:
start_recursive(sort, criteria)
else:
sort()


def main() -> None:
Expand Down
6 changes: 6 additions & 0 deletions ikdsplit/splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ def add_arguments(parser: argparse.ArgumentParser) -> None:
type=int,
help="maximum configurations to be checked",
)
parser.add_argument(
"-r",
"--recursive",
action="store_true",
help="run recursively",
)


def run(args: argparse.Namespace) -> None:
Expand Down
1 change: 1 addition & 0 deletions tests/test_fill.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ def test_fill(data_path, tmp_path) -> None:
for _ in fns:
if (src / _).exists():
shutil.copy2(src / _, tmp_path)

with cd(tmp_path):
assert subprocess.call(["ikdsplit", "fill"]) == 0
12 changes: 8 additions & 4 deletions tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ def test_run(data_path: str, tmp_path) -> None:
if (src / _).exists():
shutil.copy2(src / _, tmp_path)

commands = [
["ikdsplit", "split", "-r"],
["ikdsplit", "fill", "-r", "-l", str(level)],
["ikdsplit", "regress", "-r", "-l", str(level)],
["ikdsplit", "sort", "-r", "-l", str(level)],
]
with cd(tmp_path):
assert subprocess.call(["ikdsplit", "split"]) == 0
assert subprocess.call(["ikdsplit", "fill", "-l", str(level)]) == 0
assert subprocess.call(["ikdsplit", "regress", "-l", str(level)]) == 0
assert subprocess.call(["ikdsplit", "sort", "-l", str(level)]) == 0
for command in commands:
assert subprocess.call(command) == 0

0 comments on commit a26ad87

Please sign in to comment.