@@ -84,23 +84,37 @@ def nep_metadata():
84
84
f"no Replaces tag."
85
85
)
86
86
87
- if not int (replacement_nep [ 'Replaces' ]) == nr :
87
+ if nr not in parse_replaces_metadata (replacement_nep ) :
88
88
raise RuntimeError (
89
89
f'NEP { nr } is superseded by { replaced_by } , but that NEP has a '
90
90
f"Replaces tag of `{ replacement_nep ['Replaces' ]} `."
91
91
)
92
92
93
93
if 'Replaces' in tags :
94
- replaced_nep = int (tags ['Replaces' ])
95
- replaced_nep_tags = neps [replaced_nep ]
96
- if not replaced_nep_tags ['Status' ] == 'Superseded' :
97
- raise RuntimeError (
98
- f'NEP { nr } replaces { replaced_nep } , but that NEP has not '
99
- f'been set to Superseded'
100
- )
94
+ replaced_neps = parse_replaces_metadata (tags )
95
+ for nr_replaced in replaced_neps :
96
+ replaced_nep_tags = neps [nr_replaced ]
97
+ if not replaced_nep_tags ['Status' ] == 'Superseded' :
98
+ raise RuntimeError (
99
+ f'NEP { nr } replaces NEP { nr_replaced } , but that NEP '
100
+ 'has not been set to Superseded'
101
+ )
101
102
102
103
return {'neps' : neps , 'has_provisional' : has_provisional }
103
104
105
+
106
+ def parse_replaces_metadata (replacement_nep ):
107
+ """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
+
115
+ return replaced_neps
116
+
117
+
104
118
meta = nep_metadata ()
105
119
106
120
for nepcat in (
0 commit comments