Skip to content

Commit

Permalink
feat: add group field in team (#27)
Browse files Browse the repository at this point in the history
* feat: add group field in team

Signed-off-by: Dup4 <lyuzhi.pan@gmail.com>

* feat: add set method

Signed-off-by: Dup4 <lyuzhi.pan@gmail.com>

---------

Signed-off-by: Dup4 <lyuzhi.pan@gmail.com>
  • Loading branch information
Dup4 authored May 19, 2024
1 parent ad3fea5 commit 2889120
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 11 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

17 changes: 13 additions & 4 deletions xcpcio_board_spider/type/team.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def __init__(self,
unofficial: bool = False,
girl: bool = False,
location: str = None,
group: typing.List[str] = [],
extra: typing.Dict[str, typing.Any] = None):
self.team_id = team_id
self.name = name
Expand All @@ -29,10 +30,16 @@ def __init__(self,

self.location = location

if extra is None:
self.extra = {}
else:
self.extra = extra
self.group = group
self.extra = extra if extra is not None else {}

def enable_group(self, group: str):
if group not in self.group:
self.group.append(group)

def disable_group(self, group: str):
if group in self.group:
self.group.remove(group)

@property
def get_dict(self):
Expand All @@ -57,6 +64,8 @@ def get_dict(self):
if self.location is not None:
obj["location"] = self.location

obj["group"] = self.group

return obj

@property
Expand Down

0 comments on commit 2889120

Please sign in to comment.