Skip to content

Commit 1048568

Browse files
committed
Botched rebase cleanup.
1 parent a24ab00 commit 1048568

File tree

1 file changed

+0
-92
lines changed

1 file changed

+0
-92
lines changed

site/index.md

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -149,98 +149,6 @@ p.add_layout(legend, "below")
149149
show(p)
150150
```
151151

152-
% TODO: Figure out why bokeh won't render when output_notebook is in a hidden cell
153-
154-
```{code-cell} ipython3
155-
---
156-
tags: []
157-
---
158-
# For interactive plots
159-
from bokeh.plotting import figure, show, output_notebook
160-
from bokeh.palettes import Category10_10 as palette
161-
output_notebook()
162-
```
163-
164-
% TODO: automate project generation based on which data files are in devstats-data
165-
166-
```{code-cell} ipython3
167-
---
168-
tags: [remove-cell]
169-
---
170-
import json
171-
import datetime
172-
import itertools
173-
from dateutil.parser import isoparse
174-
import numpy as np
175-
import matplotlib.pyplot as plt
176-
177-
projects = [
178-
"numpy", "scipy", "matplotlib", "pandas", "scikit-learn", "scikit-image", "networkx"
179-
]
180-
181-
project_prs = dict()
182-
for proj in projects:
183-
with open(f"../devstats-data/{proj}_prs.json") as fh:
184-
data = [item["node"] for item in json.loads(fh.read())]
185-
186-
# Only consider prs to the main development branch
187-
default_branches = {"main", "master"}
188-
prs = [pr for pr in data if pr["baseRefName"] in default_branches]
189-
190-
# Ignore PRs with unknown author
191-
prs = [pr for pr in prs if pr["author"]] # Failed author query results in None
192-
193-
# Ignore bots
194-
bot_filter = {"dependabot-preview"}
195-
prs = [pr for pr in prs if pr["author"]["login"] not in bot_filter]
196-
197-
# Split into merged and open
198-
merged_prs = [pr for pr in prs if pr["state"] == "MERGED"]
199-
open_prs = [pr for pr in prs if pr["state"] == "OPEN"]
200-
201-
# Only look at PRs that have been created or merged in the last year
202-
today = np.datetime64(datetime.datetime.now(), "D")
203-
year = np.timedelta64(365, "D")
204-
merged_prs = [
205-
pr for pr in merged_prs
206-
if (today - np.datetime64(pr["mergedAt"], "D")) < year
207-
]
208-
open_prs = [
209-
pr for pr in open_prs
210-
if (today - np.datetime64(pr["createdAt"], "D")) < year
211-
]
212-
213-
project_prs[proj] = {
214-
"open_prs" : open_prs,
215-
"merged_prs" : merged_prs,
216-
}
217-
```
218-
219-
```{code-cell} ipython3
220-
---
221-
tags: [remove-cell]
222-
---
223-
# Num merged PRs per month
224-
start_date = today - year
225-
bedges = np.array(
226-
[start_date + i * np.timedelta64(30, "D") for i in range(13)], dtype=np.datetime64
227-
)
228-
# Proxy date for center of bin
229-
x = bedges[:-1] + np.timedelta64(15, "D")
230-
231-
# NOTE: np.histogram doesn't work on datetimes
232-
merged_prs_per_month = dict()
233-
for proj, data in project_prs.items():
234-
merged_prs = data["merged_prs"]
235-
merge_dates = np.array([pr["mergedAt"] for pr in merged_prs], dtype="M8[D]")
236-
num_merged_per_month = []
237-
for lo, hi in itertools.pairwise(bedges):
238-
num_merged_per_month.append(
239-
sum(1 for md in merge_dates if md > lo and md < hi)
240-
)
241-
merged_prs_per_month[proj] = num_merged_per_month
242-
```
243-
244152
```{code-cell} ipython3
245153
---
246154
tags: [remove-input]

0 commit comments

Comments
 (0)