remove bare list, dict, Sequence, None, Any (#25058)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
@@ -128,7 +128,7 @@ class FeatureBrandingService:
|
||||
class EmailSender(Protocol):
|
||||
"""Protocol for email sending abstraction."""
|
||||
|
||||
def send_email(self, to: str, subject: str, html_content: str) -> None:
|
||||
def send_email(self, to: str, subject: str, html_content: str):
|
||||
"""Send email with given parameters."""
|
||||
...
|
||||
|
||||
@@ -136,7 +136,7 @@ class EmailSender(Protocol):
|
||||
class FlaskMailSender:
|
||||
"""Flask-Mail based email sender."""
|
||||
|
||||
def send_email(self, to: str, subject: str, html_content: str) -> None:
|
||||
def send_email(self, to: str, subject: str, html_content: str):
|
||||
"""Send email using Flask-Mail."""
|
||||
if mail.is_inited():
|
||||
mail.send(to=to, subject=subject, html=html_content)
|
||||
@@ -156,7 +156,7 @@ class EmailI18nService:
|
||||
renderer: EmailRenderer,
|
||||
branding_service: BrandingService,
|
||||
sender: EmailSender,
|
||||
) -> None:
|
||||
):
|
||||
self._config = config
|
||||
self._renderer = renderer
|
||||
self._branding_service = branding_service
|
||||
@@ -168,7 +168,7 @@ class EmailI18nService:
|
||||
language_code: str,
|
||||
to: str,
|
||||
template_context: Optional[dict[str, Any]] = None,
|
||||
) -> None:
|
||||
):
|
||||
"""
|
||||
Send internationalized email with branding support.
|
||||
|
||||
@@ -192,7 +192,7 @@ class EmailI18nService:
|
||||
to: str,
|
||||
code: str,
|
||||
phase: str,
|
||||
) -> None:
|
||||
):
|
||||
"""
|
||||
Send change email notification with phase-specific handling.
|
||||
|
||||
@@ -224,7 +224,7 @@ class EmailI18nService:
|
||||
to: str | list[str],
|
||||
subject: str,
|
||||
html_content: str,
|
||||
) -> None:
|
||||
):
|
||||
"""
|
||||
Send a raw email directly without template processing.
|
||||
|
||||
|
@@ -16,7 +16,7 @@ def http_status_message(code):
|
||||
return HTTP_STATUS_CODES.get(code, "")
|
||||
|
||||
|
||||
def register_external_error_handlers(api: Api) -> None:
|
||||
def register_external_error_handlers(api: Api):
|
||||
@api.errorhandler(HTTPException)
|
||||
def handle_http_exception(e: HTTPException):
|
||||
got_request_exception.send(current_app, exception=e)
|
||||
|
@@ -3,7 +3,7 @@ import json
|
||||
from core.llm_generator.output_parser.errors import OutputParserError
|
||||
|
||||
|
||||
def parse_json_markdown(json_string: str) -> dict:
|
||||
def parse_json_markdown(json_string: str):
|
||||
# Get json from the backticks/braces
|
||||
json_string = json_string.strip()
|
||||
starts = ["```json", "```", "``", "`", "{"]
|
||||
@@ -33,7 +33,7 @@ def parse_json_markdown(json_string: str) -> dict:
|
||||
return parsed
|
||||
|
||||
|
||||
def parse_and_check_json_markdown(text: str, expected_keys: list[str]) -> dict:
|
||||
def parse_and_check_json_markdown(text: str, expected_keys: list[str]):
|
||||
try:
|
||||
json_obj = parse_json_markdown(text)
|
||||
except json.JSONDecodeError as e:
|
||||
|
@@ -7,10 +7,9 @@ https://github.com/django/django/blob/main/django/utils/module_loading.py
|
||||
|
||||
import sys
|
||||
from importlib import import_module
|
||||
from typing import Any
|
||||
|
||||
|
||||
def cached_import(module_path: str, class_name: str) -> Any:
|
||||
def cached_import(module_path: str, class_name: str):
|
||||
"""
|
||||
Import a module and return the named attribute/class from it, with caching.
|
||||
|
||||
@@ -30,7 +29,7 @@ def cached_import(module_path: str, class_name: str) -> Any:
|
||||
return getattr(module, class_name)
|
||||
|
||||
|
||||
def import_string(dotted_path: str) -> Any:
|
||||
def import_string(dotted_path: str):
|
||||
"""
|
||||
Import a dotted module path and return the attribute/class designated by
|
||||
the last name in the path. Raise ImportError if the import failed.
|
||||
|
Reference in New Issue
Block a user