mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
fix: remove duplicate function definitions and add missing return type
Remove duplicate _detect_export_style_cached and _get_template definitions that were introduced by the optimization. Add return type annotation to _get_template to fix mypy errors. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e463c9e03e
commit
570f5171d2
1 changed files with 2 additions and 20 deletions
|
|
@ -12,6 +12,7 @@ from pathlib import Path
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
import sentry_sdk
|
||||
from jinja2 import Template
|
||||
from ninja.errors import HttpError
|
||||
from openai.types.chat import ChatCompletionMessageParam
|
||||
|
||||
|
|
@ -686,7 +687,6 @@ def _render_user_template(
|
|||
)
|
||||
|
||||
|
||||
|
||||
# Cache export-style detection results to avoid repeated expensive regex scans of identical inputs.
|
||||
# Using a small bounded cache keeps memory usage reasonable.
|
||||
@lru_cache(maxsize=256)
|
||||
|
|
@ -694,25 +694,7 @@ def _detect_export_style_cached(source_code: str, identifier: str) -> str | None
|
|||
return _detect_export_style(source_code, identifier)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Cache template objects so get_template isn't repeatedly executed for the same name.
|
||||
@lru_cache(maxsize=32)
|
||||
def _get_template(template_name: str):
|
||||
return _jinja_env.get_template(template_name)
|
||||
|
||||
|
||||
# Cache export-style detection results to avoid repeated expensive regex scans of identical inputs.
|
||||
# Using a small bounded cache keeps memory usage reasonable.
|
||||
@lru_cache(maxsize=256)
|
||||
def _detect_export_style_cached(source_code: str, identifier: str) -> str | None:
|
||||
return _detect_export_style(source_code, identifier)
|
||||
|
||||
|
||||
|
||||
|
||||
# Cache template objects so get_template isn't repeatedly executed for the same name.
|
||||
@lru_cache(maxsize=32)
|
||||
def _get_template(template_name: str):
|
||||
def _get_template(template_name: str) -> Template:
|
||||
return _jinja_env.get_template(template_name)
|
||||
|
|
|
|||
Loading…
Reference in a new issue