Skip to content

Commit 0615f55

Browse files
committed
Fixed some more ruff check issues
1 parent 9face63 commit 0615f55

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

codeflash/code_utils/formatter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
from codeflash.cli_cmds.console import console, logger
1212
from codeflash.code_utils.code_replacer import OptimFunctionCollector
13-
from codeflash.discovery.functions_to_optimize import FunctionToOptimize
14-
from codeflash.models.models import FunctionParent, FunctionSource
1513

1614
if TYPE_CHECKING:
1715
from pathlib import Path
1816

17+
from codeflash.discovery.functions_to_optimize import FunctionToOptimize
18+
from codeflash.models.models import FunctionParent, FunctionSource
1919

2020
def format_code(formatter_cmds: list[str], path: Path) -> str:
2121
# TODO: Only allow a particular whitelist of formatters here to prevent arbitrary code execution
@@ -66,7 +66,7 @@ def get_modification_code_ranges(
6666
preexisting_functions: set[tuple[str, tuple[FunctionParent,...]]],
6767
helper_functions: list[FunctionSource],
6868
) -> list[tuple[int, int]]:
69-
"""Returns the starting and ending line numbers of modified and new functions in a file containing edits.
69+
"""Returns the starting and ending line numbers of modified and new functions in a file with edits.
7070
"""
7171
modified_functions = set()
7272
modified_functions.add(fto.qualified_name)

codeflash/optimization/function_optimizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,8 +633,8 @@ def reformat_code_and_helpers(
633633
raise Exception("Formatting had unexpected effects on code ranges")
634634

635635
# It is important to sort in descending order so that the index arithmetic remains simple as we modify new_code
636-
code_ranges_unformatted.sort(key=lambda range: range[0], reverse=True)
637-
code_ranges_formatted.sort(key=lambda range: range[0], reverse=True)
636+
code_ranges_unformatted.sort(key=lambda r: r[0], reverse=True)
637+
code_ranges_formatted.sort(key=lambda r: r[0], reverse=True)
638638
formatted_code_lines = formatted_code.split("\n")
639639
new_code_lines = unformatted_code.split("\n")
640640
for range_0, range_1 in zip(code_ranges_unformatted, code_ranges_formatted):

0 commit comments

Comments
 (0)