Some checks failed
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-school (push) Successful in 28s
CI / test-go-edu-search (push) Successful in 28s
CI / test-python-klausur (push) Failing after 2m22s
CI / test-python-agent-core (push) Successful in 21s
CI / test-nodejs-website (push) Successful in 23s
korrektur/ zeugnis/ admin/ compliance/ worksheet/ training/ metrics/ 52 shims, relative imports, RAG untouched. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
61 lines
1.6 KiB
Python
61 lines
1.6 KiB
Python
"""
|
|
Erwartungshorizont Templates — registry for template lookup.
|
|
"""
|
|
|
|
from typing import Dict, List, Optional
|
|
|
|
from .eh_templates_types import EHTemplate, AUFGABENTYPEN
|
|
from .eh_templates_analyse import (
|
|
get_textanalyse_template,
|
|
get_gedichtanalyse_template,
|
|
get_prosaanalyse_template,
|
|
get_dramenanalyse_template,
|
|
)
|
|
from .eh_templates_eroerterung import get_eroerterung_template
|
|
|
|
|
|
TEMPLATES: Dict[str, EHTemplate] = {}
|
|
|
|
|
|
def initialize_templates():
|
|
"""Initialize all pre-defined templates."""
|
|
global TEMPLATES
|
|
TEMPLATES = {
|
|
"textanalyse_pragmatisch": get_textanalyse_template(),
|
|
"gedichtanalyse": get_gedichtanalyse_template(),
|
|
"eroerterung_textgebunden": get_eroerterung_template(),
|
|
"prosaanalyse": get_prosaanalyse_template(),
|
|
"dramenanalyse": get_dramenanalyse_template(),
|
|
}
|
|
|
|
|
|
def get_template(aufgabentyp: str) -> Optional[EHTemplate]:
|
|
"""Get a template by Aufgabentyp."""
|
|
if not TEMPLATES:
|
|
initialize_templates()
|
|
return TEMPLATES.get(aufgabentyp)
|
|
|
|
|
|
def list_templates() -> List[Dict]:
|
|
"""List all available templates."""
|
|
if not TEMPLATES:
|
|
initialize_templates()
|
|
return [
|
|
{
|
|
"aufgabentyp": typ,
|
|
"name": AUFGABENTYPEN.get(typ, {}).get("name", typ),
|
|
"description": AUFGABENTYPEN.get(typ, {}).get("description", ""),
|
|
"category": AUFGABENTYPEN.get(typ, {}).get("category", "other"),
|
|
}
|
|
for typ in TEMPLATES.keys()
|
|
]
|
|
|
|
|
|
def get_aufgabentypen() -> Dict:
|
|
"""Get all Aufgabentypen definitions."""
|
|
return AUFGABENTYPEN
|
|
|
|
|
|
# Initialize on import
|
|
initialize_templates()
|