MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / issues_closed_since

Function issues_closed_since

tools/github_stats.py:105–138  ·  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='matplotlib/matplotlib', pulls=False)

Source from the content-addressed store, hash-verified

103
104
105def issues_closed_since(period=timedelta(days=365),
106 project='matplotlib/matplotlib', pulls=False):
107 """
108 Get all issues closed since a particular point in time.
109
110 *period* can either be a datetime object, or a timedelta object. In the
111 latter case, it is used as a time before the present.
112 """
113
114 which = 'pulls' if pulls else 'issues'
115
116 if isinstance(period, timedelta):
117 since = round_hour(datetime.utcnow() - period)
118 else:
119 since = period
120 url = (
121 f'https://api.github.com/repos/{project}/{which}'
122 f'?state=closed'
123 f'&sort=updated'
124 f'&since={since.strftime(ISO8601)}'
125 f'&per_page={PER_PAGE}')
126 allclosed = get_paged_request(url, headers=make_auth_header())
127
128 filtered = (i for i in allclosed
129 if _parse_datetime(i['closed_at']) > since)
130 if pulls:
131 filtered = (i for i in filtered
132 if _parse_datetime(i['merged_at']) > since)
133 # filter out PRs not against main (backports)
134 filtered = (i for i in filtered if i['base']['ref'] == 'main')
135 else:
136 filtered = (i for i in filtered if not is_pull_request(i))
137
138 return list(filtered)
139
140
141def 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…