Commit ·
4fc97b7
1
Parent(s): 628b29b
Fix Python 3.9 compatibility: Optional instead of pipe union
Browse files- core/module_registry.py +3 -3
core/module_registry.py
CHANGED
|
@@ -6,7 +6,7 @@ import importlib
|
|
| 6 |
import pkgutil
|
| 7 |
import logging
|
| 8 |
from pathlib import Path
|
| 9 |
-
from typing import List, Dict, Any, Callable
|
| 10 |
from fastapi import FastAPI
|
| 11 |
|
| 12 |
logger = logging.getLogger(__name__)
|
|
@@ -67,7 +67,7 @@ class ModuleRegistry:
|
|
| 67 |
|
| 68 |
return discovered
|
| 69 |
|
| 70 |
-
def load_module(self, module_name: str, modules_package: str = "modules") -> ModuleInfo
|
| 71 |
"""Load a single module and return its info"""
|
| 72 |
try:
|
| 73 |
full_module_name = f"{modules_package}.{module_name}"
|
|
@@ -125,7 +125,7 @@ class ModuleRegistry:
|
|
| 125 |
logger.info(f"Registered {registered}/{len(module_names)} modules")
|
| 126 |
return registered
|
| 127 |
|
| 128 |
-
def get_module(self, name: str) -> ModuleInfo
|
| 129 |
"""Get info about a specific module"""
|
| 130 |
return self._modules.get(name)
|
| 131 |
|
|
|
|
| 6 |
import pkgutil
|
| 7 |
import logging
|
| 8 |
from pathlib import Path
|
| 9 |
+
from typing import List, Dict, Any, Callable, Optional
|
| 10 |
from fastapi import FastAPI
|
| 11 |
|
| 12 |
logger = logging.getLogger(__name__)
|
|
|
|
| 67 |
|
| 68 |
return discovered
|
| 69 |
|
| 70 |
+
def load_module(self, module_name: str, modules_package: str = "modules") -> Optional[ModuleInfo]:
|
| 71 |
"""Load a single module and return its info"""
|
| 72 |
try:
|
| 73 |
full_module_name = f"{modules_package}.{module_name}"
|
|
|
|
| 125 |
logger.info(f"Registered {registered}/{len(module_names)} modules")
|
| 126 |
return registered
|
| 127 |
|
| 128 |
+
def get_module(self, name: str) -> Optional[ModuleInfo]:
|
| 129 |
"""Get info about a specific module"""
|
| 130 |
return self._modules.get(name)
|
| 131 |
|