99def decommify (name ):
1010 return ' ' .join (name .split (', ' )[::- 1 ])
1111
12+
1213# Users who have asked not to be cited at this time
1314# XXX We should add a shortlog since the most recent tag and explicitly note
1415# that a blacklisted user has contributed again recently, and verify they still
1516# do not want to be cited.
16- blacklist = {'Cecile Madjar' , 'Matthew Wardrop' , 'Peter Van Dyken' , 'github-actions[bot]' }
17+ blacklist = {
18+ 'Cecile Madjar' ,
19+ 'Matthew Wardrop' ,
20+ 'Peter Van Dyken' ,
21+ 'github-actions[bot]' ,
22+ 'dependabot[bot]' ,
23+ }
1724
1825# List of repositories whose commits should be counted as contributions
1926codependents = [('https://github.com/grabbles/grabbit.git' , '0.2.6' )]
@@ -27,12 +34,16 @@ def decommify(name):
2734zenodo = json .loads (zenodo_file .read_text ()) if zenodo_file .exists () else {}
2835
2936orig_creators = zenodo .get ('creators' , [])
30- creator_map = {decommify (creator ['name' ]): creator
31- for creator in orig_creators }
37+ creator_map = {
38+ decommify (creator ['name' ]): creator for creator in orig_creators
39+ }
3240
3341shortlog = run (['git' , 'shortlog' , '-ns' , f'{ origin_commit } ..' ], stdout = PIPE )
34- counts = [line .split ('\t ' , 1 )[::- 1 ]
35- for line in shortlog .stdout .decode ().split ('\n ' ) if line ]
42+ counts = [
43+ line .split ('\t ' , 1 )[::- 1 ]
44+ for line in shortlog .stdout .decode ().split ('\n ' )
45+ if line
46+ ]
3647
3748# Get additional commit counts from dependencies
3849with TemporaryDirectory () as tmpdir :
@@ -46,19 +57,21 @@ def decommify(name):
4657 try :
4758 clone = run (['git' , 'clone' , '-q' , repo , repo_dir ], check = True )
4859 except CalledProcessError as err :
49- raise RuntimeError (" Could not clone {}" . format ( repo ) ) from err
60+ raise RuntimeError (f' Could not clone { repo } ' ) from err
5061
5162 if ref is None :
5263 tag = run (['git' , '-C' , repo_dir , 'tag' ], stdout = PIPE )
5364 # latest tag
5465 ref = tag .stdout .decode ().strip ().rsplit ('\n ' , 1 )[1 ]
5566
5667 dep_shortlog = run (
57- ['git' , '-C' , repo_dir , 'shortlog' , '-ns' , ref ],
58- stdout = PIPE )
59- counts .extend (line .split ('\t ' , 1 )[::- 1 ]
60- for line in dep_shortlog .stdout .decode ().split ('\n ' )
61- if line )
68+ ['git' , '-C' , repo_dir , 'shortlog' , '-ns' , ref ], stdout = PIPE
69+ )
70+ counts .extend (
71+ line .split ('\t ' , 1 )[::- 1 ]
72+ for line in dep_shortlog .stdout .decode ().split ('\n ' )
73+ if line
74+ )
6275
6376commit_counts = {}
6477for committer , commits in counts :
@@ -67,9 +80,12 @@ def decommify(name):
6780# Stable sort:
6881# Number of commits in reverse order
6982# Ties broken by alphabetical order of first name
70- committers = [committer
71- for committer , _ in sorted (commit_counts .items (),
72- key = lambda x : (- x [1 ], x [0 ]))]
83+ committers = [
84+ committer
85+ for committer , _ in sorted (
86+ commit_counts .items (), key = lambda x : (- x [1 ], x [0 ])
87+ )
88+ ]
7389
7490# Tal to the top
7591first_author = 'Tal Yarkoni'
@@ -81,7 +97,7 @@ def decommify(name):
8197 creator_map .get (committer , {'name' : committer })
8298 for committer in committers
8399 if committer not in blacklist
84- ]
100+ ]
85101
86102zenodo ['creators' ] = creators
87103zenodo_file .write_text (json .dumps (zenodo , indent = 2 , ensure_ascii = False ) + '\n ' )
0 commit comments