Skip to content

Commit 1dc28c9

Browse files
committed
Define a new function to get all label groups
1 parent a552e48 commit 1dc28c9

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

normalize_repos/get_labels.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@
66
from models import Group, Label
77

88

9+
def get_groups():
10+
"""
11+
Get the list of label groups.
12+
@return: the list of label groups.
13+
"""
14+
15+
labels_dict = load_json_from_file("labels")
16+
groups = []
17+
for group_info in labels_dict["groups"]:
18+
group = Group(**group_info)
19+
label_names = group_info.pop("labels", [])
20+
groups.append(group)
21+
for label_info in label_names:
22+
Label(**label_info, group=group)
23+
return groups
24+
25+
926
def get_standard_labels():
1027
"""
1128
Get the list of standard labels that apply to every repository.
@@ -102,4 +119,4 @@ def get_labels():
102119
return standard_labels, repo_specific_labels
103120

104121

105-
__all__ = [get_labels]
122+
__all__ = [get_labels, get_groups]

0 commit comments

Comments
 (0)