fixes and modelgen insert
This commit is contained in:
38
tools/modelgen/loader/extract/base.py
Normal file
38
tools/modelgen/loader/extract/base.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""
|
||||
Base Extractor
|
||||
|
||||
Abstract base class for model extractors.
|
||||
"""
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
|
||||
from ..schema import EnumDefinition, ModelDefinition
|
||||
|
||||
|
||||
class BaseExtractor(ABC):
|
||||
"""Abstract base for codebase model extractors."""
|
||||
|
||||
def __init__(self, source_path: Path):
|
||||
self.source_path = Path(source_path)
|
||||
|
||||
@abstractmethod
|
||||
def extract(self) -> tuple[List[ModelDefinition], List[EnumDefinition]]:
|
||||
"""
|
||||
Extract model definitions from source codebase.
|
||||
|
||||
Returns:
|
||||
Tuple of (models, enums)
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def detect(self) -> bool:
|
||||
"""
|
||||
Detect if this extractor can handle the source path.
|
||||
|
||||
Returns:
|
||||
True if this extractor can handle the source
|
||||
"""
|
||||
pass
|
||||
Reference in New Issue
Block a user