silence these for now
This commit is contained in:
parent
20cd0bd239
commit
6612be4a8c
7 changed files with 19 additions and 16 deletions
|
|
@ -121,7 +121,7 @@ class AiServiceClient:
|
|||
)
|
||||
return candidates
|
||||
|
||||
def optimize_code( # noqa: D417
|
||||
def optimize_code(
|
||||
self,
|
||||
source_code: str,
|
||||
dependency_code: str,
|
||||
|
|
@ -240,7 +240,7 @@ class AiServiceClient:
|
|||
n_candidates=n_candidates,
|
||||
)
|
||||
|
||||
def get_jit_rewritten_code( # noqa: D417
|
||||
def get_jit_rewritten_code(
|
||||
self, source_code: str, trace_id: str
|
||||
) -> list[OptimizedCandidate]:
|
||||
"""Rewrite the given python code for performance via jit compilation by making a request to the Django endpoint.
|
||||
|
|
@ -292,7 +292,7 @@ class AiServiceClient:
|
|||
console.rule()
|
||||
return []
|
||||
|
||||
def optimize_python_code_line_profiler( # noqa: D417
|
||||
def optimize_python_code_line_profiler(
|
||||
self,
|
||||
source_code: str,
|
||||
dependency_code: str,
|
||||
|
|
@ -522,7 +522,7 @@ class AiServiceClient:
|
|||
console.rule()
|
||||
return None
|
||||
|
||||
def get_new_explanation( # noqa: D417
|
||||
def get_new_explanation(
|
||||
self,
|
||||
source_code: str,
|
||||
optimized_code: str,
|
||||
|
|
@ -622,7 +622,7 @@ class AiServiceClient:
|
|||
console.rule()
|
||||
return ""
|
||||
|
||||
def generate_ranking( # noqa: D417
|
||||
def generate_ranking(
|
||||
self,
|
||||
trace_id: str,
|
||||
diffs: list[str],
|
||||
|
|
@ -674,7 +674,7 @@ class AiServiceClient:
|
|||
console.rule()
|
||||
return None
|
||||
|
||||
def log_results( # noqa: D417
|
||||
def log_results(
|
||||
self,
|
||||
function_trace_id: str,
|
||||
speedup_ratio: dict[str, float | None] | None,
|
||||
|
|
@ -715,7 +715,7 @@ class AiServiceClient:
|
|||
except requests.exceptions.RequestException as e:
|
||||
logger.exception(f"Error logging features: {e}")
|
||||
|
||||
def generate_regression_tests( # noqa: D417
|
||||
def generate_regression_tests(
|
||||
self,
|
||||
source_code_being_tested: str,
|
||||
function_to_optimize: FunctionToOptimize,
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ class CodeFlashBenchmarkPlugin:
|
|||
|
||||
# Process overhead information
|
||||
for row in cursor.fetchall():
|
||||
benchmark_file, benchmark_func, benchmark_line, total_overhead_ns = row
|
||||
benchmark_file, benchmark_func, _benchmark_line, total_overhead_ns = row
|
||||
benchmark_key = BenchmarkKey(module_path=benchmark_file, function_name=benchmark_func)
|
||||
overhead_by_benchmark[benchmark_key] = total_overhead_ns or 0 # Handle NULL sum case
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ if TYPE_CHECKING:
|
|||
from pathlib import Path
|
||||
|
||||
from codeflash.discovery.functions_to_optimize import FunctionToOptimize
|
||||
from codeflash.languages.base import LanguageSupport
|
||||
from codeflash.languages.base import Language, LanguageSupport
|
||||
from codeflash.languages.treesitter_utils import TreeSitterAnalyzer
|
||||
from codeflash.models.models import CodeOptimizationContext, CodeStringsMarkdown, OptimizedCandidate, ValidCode
|
||||
|
||||
ASTNodeT = TypeVar("ASTNodeT", bound=ast.AST)
|
||||
|
|
@ -703,8 +704,8 @@ def _find_insertion_line_after_imports_js(lines: list[str], analyzer: TreeSitter
|
|||
if imports:
|
||||
# Find the last import's end line
|
||||
return max(imp.end_line for imp in imports)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as exc:
|
||||
logger.debug(f"Exception occurred in _find_insertion_line_after_imports_js: {exc}")
|
||||
|
||||
# Default: insert at beginning (after any shebang/directive comments)
|
||||
for i, line in enumerate(lines):
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@ Usage:
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from codeflash.code_utils.normalizers.base import CodeNormalizer
|
||||
from codeflash.code_utils.normalizers.javascript import JavaScriptNormalizer, TypeScriptNormalizer
|
||||
from codeflash.code_utils.normalizers.python import PythonNormalizer
|
||||
|
|
|
|||
|
|
@ -83,9 +83,10 @@ class CodeNormalizer(ABC):
|
|||
try:
|
||||
normalized1 = self.normalize_for_hash(code1)
|
||||
normalized2 = self.normalize_for_hash(code2)
|
||||
return normalized1 == normalized2
|
||||
except Exception:
|
||||
return False
|
||||
else:
|
||||
return normalized1 == normalized2
|
||||
|
||||
def get_fingerprint(self, code: str) -> str:
|
||||
"""Generate a fingerprint hash for normalized code.
|
||||
|
|
|
|||
|
|
@ -994,7 +994,7 @@ def get_imported_names(import_node: cst.Import | cst.ImportFrom) -> set[str]:
|
|||
|
||||
|
||||
def remove_docstring_from_body(indented_block: cst.IndentedBlock) -> cst.CSTNode:
|
||||
"""Removes the docstring from an indented block if it exists.""" # noqa: D401
|
||||
"""Removes the docstring from an indented block if it exists."""
|
||||
if not isinstance(indented_block.body[0], cst.SimpleStatementLine):
|
||||
return indented_block
|
||||
first_stmt = indented_block.body[0].body[0]
|
||||
|
|
|
|||
|
|
@ -259,7 +259,10 @@ ignore = [
|
|||
"PERF203",
|
||||
"LOG015",
|
||||
"PLC0415",
|
||||
"UP045"
|
||||
"UP045",
|
||||
"TD007",
|
||||
"D417",
|
||||
"D401",
|
||||
]
|
||||
|
||||
[tool.ruff.lint.flake8-type-checking]
|
||||
|
|
|
|||
Loading…
Reference in a new issue