Skip to content

Commit 80b9499

Browse files
committed
Remove trailing whitespaces
1 parent 23af5a2 commit 80b9499

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

scripts/create_changelog.py

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ def get_last_name(full_name):
5252
def merge_contributors(original_file, new_contributors):
5353
"""
5454
Merge new contributors into the existing contributors XML file and sort alphabetically by last name.
55-
55+
5656
Args:
5757
original_file (str): Path to the existing contributors XML file.
58-
new_contributors (list): A list of tuples, each containing (full_name, github_username)
58+
new_contributors (list): A list of tuples, each containing (full_name, github_username)
5959
of new contributors to be added.
60-
60+
6161
Side effects:
6262
- Modifies the original XML file in-place
6363
"""
@@ -71,10 +71,10 @@ def merge_contributors(original_file, new_contributors):
7171
new_contributor.set('github', github)
7272

7373
tree.append(new_contributor)
74-
74+
7575
sorted_contributors = sorted(
7676
tree.findall('contributor'),
77-
# Items which don't have a name attribute are placed at the end
77+
# Items which don't have a name attribute are placed at the end
7878
key=lambda x: unidecode(get_last_name(x.get('name', '\x7F'))) # '\x7F' is highest ASCII value
7979
)
8080

@@ -117,15 +117,15 @@ def merge_contributors(original_file, new_contributors):
117117
contrib_line += '/>'
118118
xml_lines.append(contrib_line)
119119
xml_lines.append('</contributors>')
120-
120+
121121
with open(original_file, 'w',encoding='utf-8') as f:
122122
f.write('\n'.join(xml_lines))
123123

124124

125125
def map_git_to_names():
126126
"""
127127
Create a mapping between GitHub usernames and full names from the contributors XML file.
128-
128+
129129
Side effects:
130130
- Populates the global git_to_name dictionary with GitHub username to full name mappings
131131
"""
@@ -141,10 +141,10 @@ def map_git_to_names():
141141
def fetch_real_name(github_name):
142142
"""
143143
Fetch the full name of a GitHub user via the GitHub API.
144-
144+
145145
Args:
146146
github_name (str): GitHub username to look up.
147-
147+
148148
Side effects:
149149
- Updates the global git_to_name dictionary if a full name is found
150150
- Adds the full name and GitHub username to the global new_names list
@@ -167,9 +167,9 @@ def fetch_real_name(github_name):
167167

168168
def update_names():
169169
"""
170-
Update contributor names by replacing GitHub usernames with real names
170+
Update contributor names by replacing GitHub usernames with real names
171171
or formatted usernames (in the form @<github_username>).
172-
172+
173173
Side effects:
174174
- Attempts to fetch real names for contributors not already in global git_to_name
175175
- Modifies global all_contribs and global first_contribs to use real names or formatted usernames
@@ -192,10 +192,10 @@ def update_names():
192192
def get_release_data(tag):
193193
"""
194194
Fetch release data for a specific GitHub tag.
195-
195+
196196
Args:
197197
tag (str): The release tag to fetch data for.
198-
198+
199199
Returns:
200200
dict or None: Release data if found, otherwise None.
201201
"""
@@ -213,10 +213,10 @@ def get_release_data(tag):
213213
def get_release_date(release_data):
214214
"""
215215
Extract the publication date from release data.
216-
216+
217217
Args:
218218
release_data (dict): Release data from GitHub API.
219-
219+
220220
Returns:
221221
str: Formatted date of release (YYYY-MM-DD) or 'Unavailable' if no date is found.
222222
"""
@@ -229,10 +229,10 @@ def get_release_date(release_data):
229229
def extract_pr_info(release_data):
230230
"""
231231
Extract pull request information from release body text.
232-
232+
233233
Args:
234234
release_data (dict): Release data from GitHub API.
235-
235+
236236
Returns:
237237
list: A list of dictionaries, each containing PR details:
238238
- title: PR title
@@ -264,10 +264,10 @@ def extract_pr_info(release_data):
264264
def update_first_contribs(release_data):
265265
"""
266266
Update the set of first-time contributors from release body text.
267-
267+
268268
Args:
269269
release_data (dict): Release data from GitHub API.
270-
270+
271271
Side effects:
272272
- Adds newly identified first-time contributors to the global first_contribs set
273273
"""
@@ -282,13 +282,13 @@ def update_first_contribs(release_data):
282282
def get_authors(pr_id):
283283
"""
284284
Retrieve the authors of commits for a specific pull request.
285-
285+
286286
Args:
287287
pr_id (str): Pull request ID.
288-
288+
289289
Returns:
290290
list: Unique GitHub usernames of PR commit authors, excluding automated bot accounts.
291-
291+
292292
Side effects:
293293
- Updates the global all_contribs set with discovered authors
294294
"""
@@ -314,15 +314,15 @@ def get_authors(pr_id):
314314
def get_reviewers(pr_id, authors):
315315
"""
316316
Retrieve the reviewers of a specific pull request.
317-
317+
318318
Args:
319319
pr_id (str): Pull request ID.
320320
authors (list): List of PR authors to exclude from reviewers.
321-
321+
322322
Returns:
323-
list: Unique GitHub usernames of PR reviewers,
323+
list: Unique GitHub usernames of PR reviewers,
324324
excluding PR authors and automated bot accounts.
325-
325+
326326
Side effects:
327327
- Updates the global all_contribs set with discovered reviewers
328328
"""
@@ -359,7 +359,7 @@ def get_latest_tags():
359359
def sort_tags(tag):
360360
"""
361361
Custom sorting key for release tags to prioritize in order: beta, RC, and stable versions.
362-
362+
363363
Args:
364364
tag (str): Tag name to be sorted.
365365
"""
@@ -375,12 +375,12 @@ def sort_tags(tag):
375375
def save_to_file(filename, ver, date_of_release):
376376
"""
377377
Generate and save the changelog to a text file.
378-
378+
379379
Args:
380380
filename (str): Path to the output changelog file.
381381
ver (str): Sage version number.
382382
date_of_release (str): Date of the release.
383-
383+
384384
Side effects:
385385
- Creates a changelog file with contributor and PR information
386386
"""
@@ -453,7 +453,7 @@ def save_to_file(filename, ver, date_of_release):
453453
else:
454454
print("No information found.")
455455
exit(1)
456-
456+
457457
if new_names:
458458
merge_contributors('conf/contributors.xml',new_names)
459459
print("Added new contributors to conf/contributors.xml")

0 commit comments

Comments
 (0)