plugins.py


Plugins class

None

Plugins source
class Plugins:
    def __init__(self, markata: "Markata"):
        self.m = markata

    def __rich__(self) -> Panel:
        grid = Table.grid(expand=True)
        num_plugins = f"[bright_blue]({len(self.m._pm.get_plugins())})[/]"

        for plugin in self.m._pm.get_plugins():
            grid.add_row(
                "".join(
                    [
                        "[bright_black]",
                        ".".join(plugin.__name__.split(".")[:-1]),
                        ".[/]",
                        plugin.__name__.split(".")[-1],
                    ]
                )
            )
        return Panel(
            grid, title=f"plugins {num_plugins}", border_style="gold1", expand=False
        )

configure function

None

configure source
def configure(markata: "Markata") -> None:
    def get_plugins(self):
        try:
            return self._plugins
        except AttributeError:
            self._plugins: Plugins = Plugins(self)
            return self._plugins

    from markata import Markata

    Markata.plugins = property(get_plugins)

init method

None

init source
def __init__(self, markata: "Markata"):
        self.m = markata

rich method

None

rich source
def __rich__(self) -> Panel:
        grid = Table.grid(expand=True)
        num_plugins = f"[bright_blue]({len(self.m._pm.get_plugins())})[/]"

        for plugin in self.m._pm.get_plugins():
            grid.add_row(
                "".join(
                    [
                        "[bright_black]",
                        ".".join(plugin.__name__.split(".")[:-1]),
                        ".[/]",
                        plugin.__name__.split(".")[-1],
                    ]
                )
            )
        return Panel(
            grid, title=f"plugins {num_plugins}", border_style="gold1", expand=False
        )

get_plugins function

None

get_plugins source
def get_plugins(self):
        try:
            return self._plugins
        except AttributeError:
            self._plugins: Plugins = Plugins(self)
            return self._plugins