chore: refactor: use dataclasses for entities
ci/woodpecker/push/woodpecker Pipeline was successful Details

master
Aravinth Manivannan 2022-09-19 20:00:50 +05:30
parent 4d824a93b6
commit 820b19d114
Signed by: realaravinth
GPG Key ID: AD9F0F08E855ED88
1 changed files with 12 additions and 13 deletions

View File

@ -12,17 +12,18 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from dataclasses import dataclass
@dataclass
class Repo:
"""
A Repository
"""
def __init__(self, owner: str, name: str, is_private: bool, is_fork: bool, parent):
self.owner = owner
self.name = name
self.is_private = is_private
self.is_fork = is_fork
self.parent = parent
owner: str
name: str
is_private: bool
is_fork: bool
parent: any = None
def __repr__(self) -> str:
return self.__str__()
@ -31,13 +32,12 @@ class Repo:
return f"{self.owner}/{self.name}"
@dataclass
class User:
"""
A User
"""
def __init__(self, username: str):
self.username = username
username: str
def __repr__(self) -> str:
return self.__str__()
@ -46,13 +46,12 @@ class User:
return self.username
@dataclass
class Org:
"""
A Gitea organisation
"""
def __init__(self, username: str):
self.username = username
username: str
def __str__(self) -> str:
return self.username