blob: 23d76f81e3f7c7ec281f8b35ab28f735e70118d5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
from abc import ABC, abstractmethod
from typing import TypeAlias
from app.Item import Item
Params: TypeAlias = dict[str, str]
class PluginInterface(ABC):
name: str
def __init__(self, plugin_type: str, id: str, params: Params):
self.plugin_type = plugin_type
self.id = id
self.params = params
self.log_prefix = f"[{self.plugin_type}#{self.id}]"
def log(self, msg) -> None:
print(f"{self.log_prefix} {msg}")
@abstractmethod
def process(self, source_id: str | None, items: list[Item]) -> list[Item]:
return NotImplemented
|