Spaces:
Sleeping
Sleeping
catch bad milestones and reinstate refresh button
#2
by
lvwerra
HF staff
- opened
app.py
CHANGED
@@ -20,29 +20,36 @@ name2num_milestones = dict()
|
|
20 |
g = Github(os.environ.get('github'))
|
21 |
df = list()
|
22 |
all_status = list()
|
|
|
|
|
23 |
|
24 |
for name, repo_name in name2repo:
|
25 |
repo = g.get_repo(repo_name)
|
26 |
num_milestones = 0
|
27 |
for milestone in repo.get_milestones():
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
46 |
name2num_milestones[name] = num_milestones
|
47 |
|
48 |
copy_df = copy.deepcopy(df)
|
@@ -127,5 +134,10 @@ for name, _ in name2repo[::-1]:
|
|
127 |
|
128 |
st.plotly_chart(fig, use_container_width=True)
|
129 |
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
20 |
g = Github(os.environ.get('github'))
|
21 |
df = list()
|
22 |
all_status = list()
|
23 |
+
bad_milestones = list()
|
24 |
+
|
25 |
|
26 |
for name, repo_name in name2repo:
|
27 |
repo = g.get_repo(repo_name)
|
28 |
num_milestones = 0
|
29 |
for milestone in repo.get_milestones():
|
30 |
+
try:
|
31 |
+
num_milestones += 1
|
32 |
+
desc = dict()
|
33 |
+
for line in milestone.description.split('\n'):
|
34 |
+
tmp = line.split(":")
|
35 |
+
if len(tmp) > 1:
|
36 |
+
key = tmp[0].lower()
|
37 |
+
value = tmp[1].strip()
|
38 |
+
if key == 'status':
|
39 |
+
value = value.lower()
|
40 |
+
desc[key] = value
|
41 |
+
task_name = f"""<a href="https://www.github.com/{repo_name}/milestone/{milestone.number}", target="_black">{milestone.title}</a>"""
|
42 |
+
if desc['status'] not in all_status:
|
43 |
+
all_status.append(desc['status'])
|
44 |
+
df.append(dict(Task=task_name,
|
45 |
+
Start=desc['start date'],
|
46 |
+
Finish=milestone.due_on.strftime('%Y-%m-%d'),
|
47 |
+
Resource=desc['status'],
|
48 |
+
Description=desc['leader']))
|
49 |
+
except:
|
50 |
+
num_milestones -= 1
|
51 |
+
task_name = f"""<a href="https://www.github.com/{repo_name}/milestone/{milestone.number}", target="_black">{milestone.title}</a>"""
|
52 |
+
bad_milestones.append(task_name)
|
53 |
name2num_milestones[name] = num_milestones
|
54 |
|
55 |
copy_df = copy.deepcopy(df)
|
|
|
134 |
|
135 |
st.plotly_chart(fig, use_container_width=True)
|
136 |
|
137 |
+
if len(bad_ms):
|
138 |
+
with st.expander("Bad Milestones"):
|
139 |
+
for bms in bad_milestones:
|
140 |
+
st.markdown(bms + "\n\n", unsafe_allow_html=True)
|
141 |
+
|
142 |
+
if st.button("Refresh"):
|
143 |
+
st.experimental_rerun()
|