Skip to content

Commit 5b8d887

Browse files
committed
Added type annotations to bin/check_new_contributors.py
Assisted-by: Gemini Signed-off-by: William Deegan <bill@baddogconsulting.com>
1 parent d3b8fa0 commit 5b8d887

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

bin/check_new_contributors.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
import subprocess
1111
import sys
1212
import argparse
13+
from typing import List, Set, Tuple, Dict
1314

14-
def get_git_output(args):
15+
def get_git_output(args: List[str]) -> str:
1516
"""Runs a git command and returns its output as a string.
1617
1718
Args:
@@ -33,7 +34,7 @@ def get_git_output(args):
3334
print(e.output.decode('utf-8', errors='replace'))
3435
sys.exit(1)
3536

36-
def get_contributors_since(tag):
37+
def get_contributors_since(tag: str) -> Set[Tuple[str, str]]:
3738
"""Retrieves a set of contributors who have committed since the specified tag.
3839
3940
Args:
@@ -58,7 +59,7 @@ def get_contributors_since(tag):
5859
contributors.add((name, email))
5960
return contributors
6061

61-
def get_prior_emails(tag):
62+
def get_prior_emails(tag: str) -> Set[str]:
6263
"""Retrieves a set of email addresses for all contributors prior to the specified tag.
6364
6465
Args:
@@ -80,7 +81,7 @@ def get_prior_emails(tag):
8081
prior_emails.add(line.strip().lower())
8182
return prior_emails
8283

83-
def main():
84+
def main() -> None:
8485
"""Main function to parse arguments and print the contributor report."""
8586
parser = argparse.ArgumentParser(description="List contributors since a specified tag and identify first-time contributors.")
8687
parser.add_argument("tag", help="The git tag to start from (e.g., 4.7.0)")
@@ -104,7 +105,7 @@ def main():
104105

105106
# Prepare data for display with deduplication
106107
# Map: display_name -> is_new (boolean)
107-
contributor_status = {}
108+
contributor_status: Dict[str, bool] = {}
108109

109110
for name, email in recent_contributors:
110111
display_name = name if name else email

0 commit comments

Comments
 (0)