Skip to content

Commit b680d4d

Browse files
committed
use regex to get nep ids from tags
1 parent 6eebb37 commit b680d4d

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

doc/neps/tools/build_index.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def nep_metadata():
7575
f'NEP {nr} has been Superseded, but has no Replaced-By tag'
7676
)
7777

78-
replaced_by = int(tags['Replaced-By'])
78+
replaced_by = int(re.findall(r'\d+', tags['Replaced-By'])[0])
7979
replacement_nep = neps[replaced_by]
8080

8181
if not 'Replaces' in replacement_nep:
@@ -105,13 +105,8 @@ def nep_metadata():
105105

106106
def parse_replaces_metadata(replacement_nep):
107107
"""Handle :Replaces: as integer or list of integers"""
108-
replaces = replacement_nep['Replaces']
109-
if ' ' in replaces:
110-
# Replaces multiple NEPs, should be comma-separated ints
111-
replaced_neps = [int(s) for s in replaces.split(', ')]
112-
else:
113-
replaced_neps = [int(replaces)]
114-
108+
replaces = re.findall(r'\d+', replacement_nep['Replaces'])
109+
replaced_neps = [int(s) for s in replaces]
115110
return replaced_neps
116111

117112

0 commit comments

Comments
 (0)