Skip to content

Commit b5a611b

Browse files
committed
Use a set for badges
1 parent b444334 commit b5a611b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

python/build.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
package.setdefault('pypi_name', package['repo_name'])
3636

3737
if package.get('badges'):
38-
package['badges'] = [x.strip() for x in package['badges'].split(',')]
38+
package['badges'] = {x.strip() for x in package['badges'].split(',')}
3939
else:
40-
package['badges'] = ['pypi', 'conda']
40+
package['badges'] = {'pypi', 'conda'}
4141

4242
needs_newline = False
4343
if 'pypi' in package['badges']:
@@ -49,8 +49,8 @@
4949
else:
5050
print('not found')
5151
package['badges'].remove('pypi')
52-
if package.get('conda_channel') and 'conda' not in package['badges']:
53-
package['badges'].append('conda')
52+
if package.get('conda_channel'):
53+
package['badges'].add('conda')
5454
package.setdefault('conda_channel', 'conda-forge')
5555
if 'conda' in package['badges']:
5656
needs_newline = True
@@ -66,12 +66,12 @@
6666
if needs_newline:
6767
print()
6868

69-
if package.get('sponsors') and 'sponsor' not in package['badges']:
70-
package['badges'].append('sponsor')
71-
if package.get('site') and 'site' not in package['badges'] and 'rtd' not in package['badges']:
72-
package['badges'].append('site')
73-
if package.get('dormant') and 'dormant' not in package['badges']:
74-
package['badges'].append('dormant')
69+
if package.get('sponsors'):
70+
package['badges'].add('sponsor')
71+
if package.get('site') and package['badges'].isdisjoint({'site', 'rtd'}):
72+
package['badges'].add('site')
73+
if package.get('dormant'):
74+
package['badges'].add('dormant')
7575

7676
if 'rtd' in package['badges']:
7777
package.setdefault('rtd_name', package['repo_name'])

0 commit comments

Comments
 (0)