MCPcopy Create free account
hub / github.com/ipython/ipython / issues_closed_since

Function issues_closed_since

tools/github_stats.py:65–88  ·  view source on GitHub ↗

Get all issues closed since a particular point in time. period can either be a datetime object, or a timedelta object. In the latter case, it is used as a time before the present.

(period=timedelta(days=365), project="ipython/ipython", pulls=False)

Source from the content-addressed store, hash-verified

63
64
65def issues_closed_since(period=timedelta(days=365), project="ipython/ipython", pulls=False):
66 """Get all issues closed since a particular point in time. period
67 can either be a datetime object, or a timedelta object. In the
68 latter case, it is used as a time before the present.
69 """
70
71 which = 'pulls' if pulls else 'issues'
72
73 if isinstance(period, timedelta):
74 since = round_hour(datetime.utcnow() - period)
75 else:
76 since = period
77 url = "https://api.github.com/repos/%s/%s?state=closed&sort=updated&since=%s&per_page=%i" % (project, which, since.strftime(ISO8601), PER_PAGE)
78 allclosed = get_paged_request(url, headers=make_auth_header())
79
80 filtered = [ i for i in allclosed if _parse_datetime(i['closed_at']) > since ]
81 if pulls:
82 filtered = [ i for i in filtered if _parse_datetime(i['merged_at']) > since ]
83 # filter out PRs not against master (backports)
84 filtered = [ i for i in filtered if i['base']['ref'] == 'master' ]
85 else:
86 filtered = [ i for i in filtered if not is_pull_request(i) ]
87
88 return filtered
89
90
91def sorted_by_field(issues, field='closed_at', reverse=False):

Callers 1

github_stats.pyFile · 0.85

Calls 5

get_paged_requestFunction · 0.90
make_auth_headerFunction · 0.90
is_pull_requestFunction · 0.90
round_hourFunction · 0.85
_parse_datetimeFunction · 0.85

Tested by

no test coverage detected