fix: remove duplicate _get_user_template and add type annotations

- Remove duplicate _get_user_template function definition introduced by optimization commit
- Add return type annotation to _get_user_template() -> Template
- Add str type annotation to _render_user_template return value to satisfy mypy
- Import jinja2.Template for return type annotation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
claude[bot] 2026-04-04 18:28:01 +00:00
parent 9e9424288e
commit bf1d6201f1

View file

@ -24,6 +24,7 @@ from aiservice.validators.javascript_validator import validate_javascript_syntax
from authapp.auth import AuthenticatedRequest
from core.log_features.log_event import update_optimization_cost
from core.log_features.log_features import safe_log_features
from jinja2 import Template
from core.shared.jinja_utils import create_prompt_env
from core.shared.testgen_models import (
TestGenerationFailedError,
@ -676,7 +677,7 @@ def _render_user_template(
module_path: str,
) -> str:
tmpl = _get_user_template()
return tmpl.render(
result: str = tmpl.render(
is_async=is_async,
module_system=effective_module_system,
import_style=import_style,
@ -687,14 +688,9 @@ def _render_user_template(
module_path=module_path,
package_comment="",
)
@lru_cache(maxsize=1)
def _get_user_template():
return _jinja_env.get_template("user.md.j2")
return result
@lru_cache(maxsize=1)
def _get_user_template():
def _get_user_template() -> Template:
return _jinja_env.get_template("user.md.j2")