From 3b7c9cacc74166ca3b1c2d636c05cad6453e4ebd Mon Sep 17 00:00:00 2001 From: Trueold89 Date: Wed, 4 Sep 2024 19:38:41 +0300 Subject: [PATCH] Add abc/db.py Add types.py --- u232ping/abc/db.py | 13 +++++++++++++ u232ping/types.py | 12 ++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 u232ping/abc/db.py create mode 100644 u232ping/types.py diff --git a/u232ping/abc/db.py b/u232ping/abc/db.py new file mode 100644 index 0000000..942c59a --- /dev/null +++ b/u232ping/abc/db.py @@ -0,0 +1,13 @@ +from abc import ABC, abstractmethod +from u232ping.types import Group + +class DataBase(ABC): + + @abstractmethod + async def get_group(self, group_idx: int) -> Group: + raise NotImplementedError + + + @abstractmethod + async def get_all(self) -> Group: + raise NotImplementedError diff --git a/u232ping/types.py b/u232ping/types.py new file mode 100644 index 0000000..59b207d --- /dev/null +++ b/u232ping/types.py @@ -0,0 +1,12 @@ +from typing import Iterable + +class Group(object): + + members: Iterable + + def __init__(self, members: Iterable) -> None: + self.members = members + + def __str__(self) -> str: + lst = tuple(map(lambda member: f"@{member}", self.members)) + return "/n".join(lst)