4545
4646from __future__ import annotations
4747
48+ import concurrent .futures
4849import datetime
4950import os
5051import re
@@ -88,6 +89,7 @@ def update_citation(version, date):
8889 with open (os .path .join (current_directory , "TEMPLATE.cff" )) as a , open (
8990 os .path .join (parent_directory , "CITATION.cff" ),
9091 "w" ,
92+ newline = "\n " ,
9193 ) as b :
9294 contents = a .read ()
9395 contents = contents .replace ("<version>" , version )
@@ -102,17 +104,23 @@ def process_pullrequests(lst, cur, github_repo, pr_nums):
102104 authors = set ()
103105 reviewers = set ()
104106 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 )
116124
117125 # identify first-time contributors:
118126 author_names = []
@@ -239,7 +247,7 @@ def main(token, prior, tag, additional, outfile):
239247 else :
240248 outfile = Path (outfile ).resolve ()
241249
242- with outfile .open ("w" , encoding = "utf8" ) as f :
250+ with outfile .open ("w" , encoding = "utf8" , newline = " \n " ) as f :
243251 f .write ("*" * len (tag ) + "\n " )
244252 f .write (f"{ tag } \n " )
245253 f .write ("*" * len (tag ) + "\n \n " )
0 commit comments