mirror of
https://github.com/codeflash-ai/codeflash.git
synced 2026-05-04 18:25:17 +00:00
Many fixes, concolic test coverage.
This commit is contained in:
parent
11409bdd2f
commit
a22ce95482
4 changed files with 17 additions and 14 deletions
|
|
@ -1,4 +1,4 @@
|
|||
from __future__ import annotations
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Callable, Iterable, NewType, Optional, Protocol, TypeVar
|
||||
|
||||
|
|
|
|||
11
code_to_optimize/find_common_tags.py
Normal file
11
code_to_optimize/find_common_tags.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
from __future__ import annotations
|
||||
|
||||
|
||||
def find_common_tags(articles: list[dict[str, list[str]]]) -> set[str]:
|
||||
if not articles:
|
||||
return set()
|
||||
|
||||
common_tags = articles[0]["tags"]
|
||||
for article in articles[1:]:
|
||||
common_tags = [tag for tag in common_tags if tag in article["tags"]]
|
||||
return set(common_tags)
|
||||
|
|
@ -156,26 +156,18 @@ def get_functions_to_optimize(
|
|||
module_root: Path,
|
||||
) -> tuple[dict[Path, list[FunctionToOptimize]], int]:
|
||||
assert (
|
||||
sum(
|
||||
[ # Ensure only one of the options is provided
|
||||
bool(optimize_all),
|
||||
bool(replay_test),
|
||||
bool(file),
|
||||
]
|
||||
)
|
||||
<= 1
|
||||
sum([bool(optimize_all), bool(replay_test), bool(file)]) <= 1
|
||||
), "Only one of optimize_all, replay_test, or file should be provided"
|
||||
functions: dict[str, list[FunctionToOptimize]]
|
||||
if optimize_all:
|
||||
logger.info("Finding all functions in the module '%s' ...", optimize_all)
|
||||
logger.info("Finding all functions in the module '%s'…", optimize_all)
|
||||
functions = get_all_files_and_functions(Path(optimize_all))
|
||||
elif replay_test is not None:
|
||||
functions = get_all_replay_test_functions(
|
||||
replay_test=replay_test, test_cfg=test_cfg, project_root_path=project_root
|
||||
)
|
||||
|
||||
elif file is not None:
|
||||
logger.info("Finding all functions in the file '%s' ...", file)
|
||||
logger.info("Finding all functions in the file '%s'…", file)
|
||||
functions = find_all_functions_in_file(file)
|
||||
if only_get_this_function is not None:
|
||||
split_function = only_get_this_function.split(".")
|
||||
|
|
|
|||
|
|
@ -449,7 +449,7 @@ class Optimizer:
|
|||
[
|
||||
"crosshair",
|
||||
"diffbehavior",
|
||||
"--max_uninteresting_iterations=128",
|
||||
"--max_uninteresting_iterations=256",
|
||||
function_to_optimize_optimized_worktree_fqn,
|
||||
function_to_optimize_original_worktree_fqn,
|
||||
],
|
||||
|
|
@ -463,7 +463,7 @@ class Optimizer:
|
|||
"crosshair",
|
||||
"cover",
|
||||
"--example_output_format=pytest",
|
||||
"--max_uninteresting_iterations=128",
|
||||
"--max_uninteresting_iterations=256",
|
||||
function_to_optimize_optimized_worktree_fqn,
|
||||
],
|
||||
capture_output=True,
|
||||
|
|
|
|||
Loading…
Reference in a new issue