Skip to content

Commit 2eec000

Browse files
committed
Adding @stefanv's mergeable PR analysis.
Co-authored-by: Stefan van der Walt <stefanv@berkeley.edu>.
1 parent d364a8e commit 2eec000

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

site/numpy_timeseries.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ tags: [remove-cell]
2121
import json
2222
import functools
2323
import datetime
24+
from dateutil.parser import isoparse
2425
import warnings
2526
2627
import numpy as np
@@ -325,3 +326,44 @@ axes[1].set_ylim(axes[0].get_ylim())
325326
fig.autofmt_xdate()
326327
plt.show()
327328
```
329+
330+
### Mergeability of Open PRs
331+
332+
```{code-cell} ipython3
333+
---
334+
tags: [hide-input]
335+
---
336+
open_prs = [pr for pr in prs if pr["state"] == "OPEN"]
337+
338+
# The GraphQL query does not reliably return information on PR mergeability.
339+
# Warn if there are problems
340+
if any([pr["mergeable"] == "UNKOWN" for pr in open_prs]):
341+
warnings.warn(
342+
(
343+
"\n\nThe data contains PRs with unknown merge status.\n"
344+
"Please re-download the data to get accurate info about PR mergeability.",
345+
),
346+
UserWarning,
347+
stacklevel=2,
348+
)
349+
350+
conflicting_prs = [isoparse(pr["createdAt"]) for pr in open_prs if pr["mergeable"] == "CONFLICTING"]
351+
mergeable_prs = [isoparse(pr["createdAt"]) for pr in open_prs if pr["mergeable"] == "MERGEABLE"]
352+
353+
fig, ax = plt.subplots(figsize=(6, 4))
354+
ax.hist(
355+
[conflicting_prs, mergeable_prs],
356+
bins="auto",
357+
histtype="bar",
358+
label=("conflicting", "mergeable"),
359+
color=("tab:red", "tab:blue"),
360+
)
361+
ax.legend()
362+
ax.set_xlabel("Date of PR creation")
363+
ax.set_ylabel(r"# of conflicting PRs")
364+
fig.autofmt_xdate()
365+
fig.tight_layout()
366+
```
367+
368+
369+
```

0 commit comments

Comments
 (0)