clean: code cleaning
This commit is contained in:
@@ -9,22 +9,40 @@ from .assessment_services import (
|
||||
GradingStrategyFactory
|
||||
)
|
||||
|
||||
# Import de l'ancien service pour rétrocompatibilité
|
||||
import importlib.util
|
||||
import os
|
||||
# Legacy service - TODO: Migrer vers architecture moderne
|
||||
# Import via path absolu pour éviter circularité
|
||||
import sys
|
||||
from pathlib import Path
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
|
||||
# Charger AssessmentService depuis services.py
|
||||
try:
|
||||
services_file_path = os.path.join(os.path.dirname(__file__), '..', 'services.py')
|
||||
spec = importlib.util.spec_from_file_location("legacy_services", services_file_path)
|
||||
legacy_services = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(legacy_services)
|
||||
AssessmentService = legacy_services.AssessmentService
|
||||
except Exception:
|
||||
# Fallback en cas d'erreur
|
||||
# Import direct pour éviter la circularité
|
||||
from importlib import import_module
|
||||
spec_path = Path(__file__).parent.parent / 'services.py'
|
||||
if spec_path.exists():
|
||||
# Import dynamique du module legacy
|
||||
import importlib.util
|
||||
spec = importlib.util.spec_from_file_location("legacy_services", spec_path)
|
||||
legacy_module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(legacy_module)
|
||||
AssessmentService = legacy_module.AssessmentService
|
||||
else:
|
||||
raise ImportError("Legacy services.py not found")
|
||||
except ImportError:
|
||||
# Fallback minimal
|
||||
class AssessmentService:
|
||||
"""Fallback pour AssessmentService"""
|
||||
pass
|
||||
"""Fallback pour AssessmentService - migration required"""
|
||||
@staticmethod
|
||||
def process_assessment_with_exercises(*args, **kwargs):
|
||||
raise NotImplementedError("Legacy service not available")
|
||||
|
||||
@staticmethod
|
||||
def create_assessment(*args, **kwargs):
|
||||
raise NotImplementedError("Legacy service not available")
|
||||
|
||||
@staticmethod
|
||||
def update_assessment_basic_info(*args, **kwargs):
|
||||
raise NotImplementedError("Legacy service not available")
|
||||
|
||||
__all__ = [
|
||||
'AssessmentService', # Service legacy
|
||||
|
||||
Reference in New Issue
Block a user