Update Exploring Near Earth Objects project and add Meme Generator project
This commit is contained in:
23
Meme_Generator/QuoteEngine/IngestorInterface.py
Normal file
23
Meme_Generator/QuoteEngine/IngestorInterface.py
Normal file
@@ -0,0 +1,23 @@
|
||||
"""Ingestor Interface module for quote ingestion."""
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import List
|
||||
from .QuoteModel import QuoteModel
|
||||
|
||||
|
||||
class IngestorInterface(ABC):
|
||||
"""Base Ingestor Interface."""
|
||||
|
||||
allowed_extensions = []
|
||||
|
||||
@classmethod
|
||||
def can_ingest(cls, path: str) -> bool:
|
||||
"""Check if the ingestor can ingest the file based on its extension."""
|
||||
ext = path.split(".")[-1]
|
||||
return ext in cls.allowed_extensions
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def parse(cls, path: str) -> List[QuoteModel]:
|
||||
"""Abstract method to parse the file and return a list of QuoteModel objects."""
|
||||
pass
|
||||
Reference in New Issue
Block a user