File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ tags: [remove-cell]
2121import json
2222import functools
2323import datetime
24+ from dateutil.parser import isoparse
2425import warnings
2526
2627import numpy as np
@@ -325,3 +326,44 @@ axes[1].set_ylim(axes[0].get_ylim())
325326fig.autofmt_xdate()
326327plt.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+ ```
You can’t perform that action at this time.
0 commit comments