45
45
46
46
from __future__ import annotations
47
47
48
+ import concurrent .futures
48
49
import datetime
49
50
import os
50
51
import re
@@ -88,6 +89,7 @@ def update_citation(version, date):
88
89
with open (os .path .join (current_directory , "TEMPLATE.cff" )) as a , open (
89
90
os .path .join (parent_directory , "CITATION.cff" ),
90
91
"w" ,
92
+ newline = "\n " ,
91
93
) as b :
92
94
contents = a .read ()
93
95
contents = contents .replace ("<version>" , version )
@@ -102,17 +104,23 @@ def process_pullrequests(lst, cur, github_repo, pr_nums):
102
104
authors = set ()
103
105
reviewers = set ()
104
106
pr_by_labels = defaultdict (list )
105
- for num in tqdm (pr_nums , desc = "Processing PRs" ):
106
- pr = github_repo .get_pull (num )
107
- authors .add (pr .user )
108
- reviewers = reviewers .union (rev .user for rev in pr .get_reviews ())
109
- pr_labels = [label .name for label in pr .labels ]
110
- for label in PR_LABELS .keys ():
111
- if label in pr_labels :
112
- pr_by_labels [label ].append (pr )
113
- break # ensure that PR is only added in one category
114
- else :
115
- pr_by_labels ["unlabeled" ].append (pr )
107
+ with concurrent .futures .ThreadPoolExecutor () as executor :
108
+ future_to_num = {
109
+ executor .submit (github_repo .get_pull , num ): num for num in pr_nums
110
+ }
111
+ for future in tqdm (
112
+ concurrent .futures .as_completed (future_to_num ), "Processing PRs"
113
+ ):
114
+ pr = future .result ()
115
+ authors .add (pr .user )
116
+ reviewers = reviewers .union (rev .user for rev in pr .get_reviews ())
117
+ pr_labels = [label .name for label in pr .labels ]
118
+ for label in PR_LABELS .keys ():
119
+ if label in pr_labels :
120
+ pr_by_labels [label ].append (pr )
121
+ break # ensure that PR is only added in one category
122
+ else :
123
+ pr_by_labels ["unlabeled" ].append (pr )
116
124
117
125
# identify first-time contributors:
118
126
author_names = []
@@ -239,7 +247,7 @@ def main(token, prior, tag, additional, outfile):
239
247
else :
240
248
outfile = Path (outfile ).resolve ()
241
249
242
- with outfile .open ("w" , encoding = "utf8" ) as f :
250
+ with outfile .open ("w" , encoding = "utf8" , newline = " \n " ) as f :
243
251
f .write ("*" * len (tag ) + "\n " )
244
252
f .write (f"{ tag } \n " )
245
253
f .write ("*" * len (tag ) + "\n \n " )
0 commit comments