Skip to content

Commit 6612be4

Browse files
committed
silence these for now
1 parent 20cd0bd commit 6612be4

7 files changed

Lines changed: 19 additions & 16 deletions

File tree

codeflash/api/aiservice.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def _get_valid_candidates(
121121
)
122122
return candidates
123123

124-
def optimize_code( # noqa: D417
124+
def optimize_code(
125125
self,
126126
source_code: str,
127127
dependency_code: str,
@@ -240,7 +240,7 @@ def optimize_python_code(
240240
n_candidates=n_candidates,
241241
)
242242

243-
def get_jit_rewritten_code( # noqa: D417
243+
def get_jit_rewritten_code(
244244
self, source_code: str, trace_id: str
245245
) -> list[OptimizedCandidate]:
246246
"""Rewrite the given python code for performance via jit compilation by making a request to the Django endpoint.
@@ -292,7 +292,7 @@ def get_jit_rewritten_code( # noqa: D417
292292
console.rule()
293293
return []
294294

295-
def optimize_python_code_line_profiler( # noqa: D417
295+
def optimize_python_code_line_profiler(
296296
self,
297297
source_code: str,
298298
dependency_code: str,
@@ -522,7 +522,7 @@ def code_repair(self, request: AIServiceCodeRepairRequest) -> OptimizedCandidate
522522
console.rule()
523523
return None
524524

525-
def get_new_explanation( # noqa: D417
525+
def get_new_explanation(
526526
self,
527527
source_code: str,
528528
optimized_code: str,
@@ -622,7 +622,7 @@ def get_new_explanation( # noqa: D417
622622
console.rule()
623623
return ""
624624

625-
def generate_ranking( # noqa: D417
625+
def generate_ranking(
626626
self,
627627
trace_id: str,
628628
diffs: list[str],
@@ -674,7 +674,7 @@ def generate_ranking( # noqa: D417
674674
console.rule()
675675
return None
676676

677-
def log_results( # noqa: D417
677+
def log_results(
678678
self,
679679
function_trace_id: str,
680680
speedup_ratio: dict[str, float | None] | None,
@@ -715,7 +715,7 @@ def log_results( # noqa: D417
715715
except requests.exceptions.RequestException as e:
716716
logger.exception(f"Error logging features: {e}")
717717

718-
def generate_regression_tests( # noqa: D417
718+
def generate_regression_tests(
719719
self,
720720
source_code_being_tested: str,
721721
function_to_optimize: FunctionToOptimize,

codeflash/benchmarking/plugin/plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def get_benchmark_timings(trace_path: Path) -> dict[BenchmarkKey, int]:
172172

173173
# Process overhead information
174174
for row in cursor.fetchall():
175-
benchmark_file, benchmark_func, benchmark_line, total_overhead_ns = row
175+
benchmark_file, benchmark_func, _benchmark_line, total_overhead_ns = row
176176
benchmark_key = BenchmarkKey(module_path=benchmark_file, function_name=benchmark_func)
177177
overhead_by_benchmark[benchmark_key] = total_overhead_ns or 0 # Handle NULL sum case
178178

codeflash/code_utils/code_replacer.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
from pathlib import Path
2626

2727
from codeflash.discovery.functions_to_optimize import FunctionToOptimize
28-
from codeflash.languages.base import LanguageSupport
28+
from codeflash.languages.base import Language, LanguageSupport
29+
from codeflash.languages.treesitter_utils import TreeSitterAnalyzer
2930
from codeflash.models.models import CodeOptimizationContext, CodeStringsMarkdown, OptimizedCandidate, ValidCode
3031

3132
ASTNodeT = TypeVar("ASTNodeT", bound=ast.AST)
@@ -703,8 +704,8 @@ def _find_insertion_line_after_imports_js(lines: list[str], analyzer: TreeSitter
703704
if imports:
704705
# Find the last import's end line
705706
return max(imp.end_line for imp in imports)
706-
except Exception:
707-
pass
707+
except Exception as exc:
708+
logger.debug(f"Exception occurred in _find_insertion_line_after_imports_js: {exc}")
708709

709710
# Default: insert at beginning (after any shebang/directive comments)
710711
for i, line in enumerate(lines):

codeflash/code_utils/normalizers/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
from __future__ import annotations
1818

19-
from typing import TYPE_CHECKING
20-
2119
from codeflash.code_utils.normalizers.base import CodeNormalizer
2220
from codeflash.code_utils.normalizers.javascript import JavaScriptNormalizer, TypeScriptNormalizer
2321
from codeflash.code_utils.normalizers.python import PythonNormalizer

codeflash/code_utils/normalizers/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ def are_duplicates(self, code1: str, code2: str) -> bool:
8383
try:
8484
normalized1 = self.normalize_for_hash(code1)
8585
normalized2 = self.normalize_for_hash(code2)
86-
return normalized1 == normalized2
8786
except Exception:
8887
return False
88+
else:
89+
return normalized1 == normalized2
8990

9091
def get_fingerprint(self, code: str) -> str:
9192
"""Generate a fingerprint hash for normalized code.

codeflash/context/code_context_extractor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ def get_imported_names(import_node: cst.Import | cst.ImportFrom) -> set[str]:
994994

995995

996996
def remove_docstring_from_body(indented_block: cst.IndentedBlock) -> cst.CSTNode:
997-
"""Removes the docstring from an indented block if it exists.""" # noqa: D401
997+
"""Removes the docstring from an indented block if it exists."""
998998
if not isinstance(indented_block.body[0], cst.SimpleStatementLine):
999999
return indented_block
10001000
first_stmt = indented_block.body[0].body[0]

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,10 @@ ignore = [
259259
"PERF203",
260260
"LOG015",
261261
"PLC0415",
262-
"UP045"
262+
"UP045",
263+
"TD007",
264+
"D417",
265+
"D401",
263266
]
264267

265268
[tool.ruff.lint.flake8-type-checking]

0 commit comments

Comments
 (0)