chore: refactor: use dataclasses for entities
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
parent
4d824a93b6
commit
820b19d114
|
@ -12,17 +12,18 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# 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/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
@dataclass
|
||||||
class Repo:
|
class Repo:
|
||||||
"""
|
"""
|
||||||
A Repository
|
A Repository
|
||||||
"""
|
"""
|
||||||
|
owner: str
|
||||||
def __init__(self, owner: str, name: str, is_private: bool, is_fork: bool, parent):
|
name: str
|
||||||
self.owner = owner
|
is_private: bool
|
||||||
self.name = name
|
is_fork: bool
|
||||||
self.is_private = is_private
|
parent: any = None
|
||||||
self.is_fork = is_fork
|
|
||||||
self.parent = parent
|
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return self.__str__()
|
return self.__str__()
|
||||||
|
@ -31,13 +32,12 @@ class Repo:
|
||||||
return f"{self.owner}/{self.name}"
|
return f"{self.owner}/{self.name}"
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
class User:
|
class User:
|
||||||
"""
|
"""
|
||||||
A User
|
A User
|
||||||
"""
|
"""
|
||||||
|
username: str
|
||||||
def __init__(self, username: str):
|
|
||||||
self.username = username
|
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return self.__str__()
|
return self.__str__()
|
||||||
|
@ -46,13 +46,12 @@ class User:
|
||||||
return self.username
|
return self.username
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
class Org:
|
class Org:
|
||||||
"""
|
"""
|
||||||
A Gitea organisation
|
A Gitea organisation
|
||||||
"""
|
"""
|
||||||
|
username: str
|
||||||
def __init__(self, username: str):
|
|
||||||
self.username = username
|
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return self.username
|
return self.username
|
||||||
|
|
Loading…
Reference in New Issue