Skip to content

Commit c503ecc

Browse files
committed
Update code_context_extractor.py
1 parent 09f370d commit c503ecc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

codeflash/context/code_context_extractor.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from libcst import CSTNode
2929

3030
from codeflash.discovery.functions_to_optimize import FunctionToOptimize
31+
from typing import Callable
3132

3233

3334
def get_code_optimization_context(
@@ -462,7 +463,9 @@ def parse_code_and_prune_cst(
462463
helpers_of_helper_functions = set()
463464
module = cst.parse_module(code)
464465

465-
dispatch = {
466+
dispatch: dict[
467+
CodeContextType, Callable[[cst.CSTNode, set[str], set[str], str, bool], tuple[Optional[cst.CSTNode], bool]]
468+
] = {
466469
CodeContextType.READ_WRITABLE: prune_cst_for_read_writable_code,
467470
CodeContextType.READ_ONLY: prune_cst_for_read_only_code,
468471
CodeContextType.TESTGEN: prune_cst_for_testgen_code,
@@ -474,7 +477,7 @@ def parse_code_and_prune_cst(
474477
raise ValueError(msg)
475478

476479
filtered_node, found_target = prune_func(
477-
module, target_functions, helpers_of_helper_functions
480+
module, target_functions, helpers_of_helper_functions, "", remove_docstrings
478481
)
479482

480483
if not found_target:

0 commit comments

Comments
 (0)