1
0
Fork 0

Add abc/db.py

Add types.py
This commit is contained in:
Trueold89 2024-09-04 19:38:41 +03:00
parent 1b6f0ff660
commit 3b7c9cacc7
2 changed files with 25 additions and 0 deletions

13
u232ping/abc/db.py Normal file
View File

@ -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

12
u232ping/types.py Normal file
View File

@ -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)