From e54b7e2c5f3a736f248353317007f922771ab0c7 Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Mon, 21 Jul 2025 23:04:08 -0400 Subject: refactor: remove unused backend files and improve configuration handling in TypeScript --- py_modules/lsfg_vk/base_service.py | 44 +++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'py_modules/lsfg_vk/base_service.py') diff --git a/py_modules/lsfg_vk/base_service.py b/py_modules/lsfg_vk/base_service.py index b595b07..b684ec9 100644 --- a/py_modules/lsfg_vk/base_service.py +++ b/py_modules/lsfg_vk/base_service.py @@ -5,10 +5,13 @@ Base service class with common functionality. import os import shutil from pathlib import Path -from typing import Any, Optional +from typing import Any, Optional, TypeVar, Dict from .constants import LOCAL_LIB, LOCAL_SHARE_BASE, VULKAN_LAYER_DIR, SCRIPT_NAME, CONFIG_DIR, CONFIG_FILENAME +# Generic type for response dictionaries +ResponseType = TypeVar('ResponseType', bound=Dict[str, Any]) + class BaseService: """Base service class with common functionality""" @@ -90,3 +93,42 @@ class BaseService: except Exception: self.log.error(f"Failed to write to {path}") raise + + def _success_response(self, response_type: type, message: str = "", **kwargs) -> Any: + """Create a standardized success response + + Args: + response_type: The TypedDict response type to create + message: Success message + **kwargs: Additional response fields + + Returns: + Success response dict + """ + response = { + "success": True, + "message": message, + "error": None + } + response.update(kwargs) + return response + + def _error_response(self, response_type: type, error: str, message: str = "", **kwargs) -> Any: + """Create a standardized error response + + Args: + response_type: The TypedDict response type to create + error: Error description + message: Optional message + **kwargs: Additional response fields + + Returns: + Error response dict + """ + response = { + "success": False, + "message": message, + "error": error + } + response.update(kwargs) + return response -- cgit v1.2.3