aboutsummaryrefslogtreecommitdiffstats
path: root/modules/base.py
blob: 6b325620c56fdf1fdbf6aeeef7b8976b58d52882 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from dataclasses import dataclass
from typing import Any, Dict, List, Protocol

import matplotlib.pyplot as plt
from matplotlib.axes import Axes
from matplotlib.font_manager import FontProperties


@dataclass
class Frame:
    title: str

    def render(self, ax: Axes, mono_font: FontProperties) -> None:
        raise NotImplementedError

@dataclass
class BigFrame:
    title: str

    def render(self, ax: Axes, mono_font: FontProperties) -> None:
        raise NotImplementedError

@dataclass
class ModuleResult:
    summary_text: str
    frames: List[Frame]
    bigframes: List[BigFrame]
    pages: List[plt.Figure]


class Module(Protocol):
    name: str

    def process(self, df, context: Dict[str, Any]) -> ModuleResult:
        ...