49
49
50
50
intro = """\
51
51
This PEP contains the index of all Python Enhancement Proposals,
52
- known as PEPs. PEP numbers are assigned by the PEP editors, and
53
- once assigned are never changed [1_]. The version control history [2_] of
52
+ known as PEPs. PEP numbers are :pep:`assigned <1#pep-editors>`
53
+ by the PEP editors, and once assigned are never changed. The
54
+ `version control history <https://github.com/python/peps>`_ of
54
55
the PEP texts represent their historical record.
55
56
"""
56
57
57
- references = """\
58
- .. [1] PEP 1: PEP Purpose and Guidelines
59
- .. [2] View PEP history online: https://github.com/python/peps
60
- """
61
-
62
58
63
59
class PEPZeroWriter :
64
60
# This is a list of reserved PEP numbers. Reservations are not to be used for
@@ -100,17 +96,16 @@ def emit_column_headers(self) -> None:
100
96
self .emit_pep_row ({"status" : "." , "type" : "." , "number" : "PEP" , "title" : "PEP Title" , "authors" : "PEP Author(s)" })
101
97
self .emit_table_separator ()
102
98
103
- def emit_title (self , text : str , anchor : str , * , symbol : str = "=" ) -> None :
104
- self .output .append (f".. _{ anchor } :\n " )
99
+ def emit_title (self , text : str , * , symbol : str = "=" ) -> None :
105
100
self .output .append (text )
106
101
self .output .append (symbol * len (text ))
107
102
self .emit_newline ()
108
103
109
- def emit_subtitle (self , text : str , anchor : str ) -> None :
110
- self .emit_title (text , anchor , symbol = "-" )
104
+ def emit_subtitle (self , text : str ) -> None :
105
+ self .emit_title (text , symbol = "-" )
111
106
112
- def emit_pep_category (self , category : str , anchor : str , peps : list [PEP ]) -> None :
113
- self .emit_subtitle (category , anchor )
107
+ def emit_pep_category (self , category : str , peps : list [PEP ]) -> None :
108
+ self .emit_subtitle (category )
114
109
self .emit_column_headers ()
115
110
for pep in peps :
116
111
self .output .append (column_format (** pep .details (title_length = title_length )))
@@ -124,44 +119,40 @@ def write_pep0(self, peps: list[PEP]):
124
119
self .emit_newline ()
125
120
126
121
# Introduction
127
- self .emit_title ("Introduction" , "intro" )
122
+ self .emit_title ("Introduction" )
128
123
self .emit_text (intro )
129
124
self .emit_newline ()
130
125
131
126
# PEPs by category
132
- self .emit_title ("Index by Category" , "by-category" )
127
+ self .emit_title ("Index by Category" )
133
128
meta , info , provisional , accepted , open_ , finished , historical , deferred , dead = _classify_peps (peps )
134
129
pep_categories = [
135
- ("Meta-PEPs (PEPs about PEPs or Processes)" , "by-category-meta" , meta ),
136
- ("Other Informational PEPs" , "by-category-other-info" , info ),
137
- ("Provisional PEPs (provisionally accepted; interface may still change)" , "by-category-provisional" , provisional ),
138
- ("Accepted PEPs (accepted; may not be implemented yet)" , "by-category-accepted" , accepted ),
139
- ("Open PEPs (under consideration)" , "by-category-open" , open_ ),
140
- ("Finished PEPs (done, with a stable interface)" , "by-category-finished" , finished ),
141
- ("Historical Meta-PEPs and Informational PEPs" , "by-category-historical" , historical ),
142
- ("Deferred PEPs (postponed pending further research or updates)" , "by-category-deferred" , deferred ),
143
- ("Abandoned, Withdrawn, and Rejected PEPs" , "by-category-abandoned" , dead ),
130
+ ("Meta-PEPs (PEPs about PEPs or Processes)" , meta ),
131
+ ("Other Informational PEPs" , info ),
132
+ ("Provisional PEPs (provisionally accepted; interface may still change)" , provisional ),
133
+ ("Accepted PEPs (accepted; may not be implemented yet)" , accepted ),
134
+ ("Open PEPs (under consideration)" , open_ ),
135
+ ("Finished PEPs (done, with a stable interface)" , finished ),
136
+ ("Historical Meta-PEPs and Informational PEPs" , historical ),
137
+ ("Deferred PEPs (postponed pending further research or updates)" , deferred ),
138
+ ("Abandoned, Withdrawn, and Rejected PEPs" , dead ),
144
139
]
145
- for (category , anchor , peps_in_category ) in pep_categories :
146
- self .emit_pep_category (category , anchor , peps_in_category )
140
+ for (category , peps_in_category ) in pep_categories :
141
+ self .emit_pep_category (category , peps_in_category )
147
142
148
143
self .emit_newline ()
149
144
150
145
# PEPs by number
151
- self .emit_title ("Numerical Index" , "by-pep-number" )
146
+ self .emit_title ("Numerical Index" )
152
147
self .emit_column_headers ()
153
- prev_pep = 0
154
148
for pep in peps :
155
- if pep .number - prev_pep > 1 :
156
- self .emit_newline ()
157
149
self .emit_pep_row (pep .details (title_length = title_length ))
158
- prev_pep = pep .number
159
150
160
151
self .emit_table_separator ()
161
152
self .emit_newline ()
162
153
163
154
# Reserved PEP numbers
164
- self .emit_title ("Reserved PEP Numbers" , "reserved" )
155
+ self .emit_title ("Reserved PEP Numbers" )
165
156
self .emit_column_headers ()
166
157
for number , claimants in sorted (self .RESERVED .items ()):
167
158
self .emit_pep_row ({"type" : "." , "status" : "." , "number" : number , "title" : "RESERVED" , "authors" : claimants })
@@ -170,15 +161,15 @@ def write_pep0(self, peps: list[PEP]):
170
161
self .emit_newline ()
171
162
172
163
# PEP types key
173
- self .emit_title ("PEP Types Key" , "type-key" )
164
+ self .emit_title ("PEP Types Key" )
174
165
for type_ in sorted (TYPE_VALUES ):
175
166
self .emit_text (f" { type_ [0 ]} - { type_ } PEP" )
176
167
self .emit_newline ()
177
168
178
169
self .emit_newline ()
179
170
180
171
# PEP status key
181
- self .emit_title ("PEP Status Key" , "status-key" )
172
+ self .emit_title ("PEP Status Key" )
182
173
for status in sorted (STATUS_VALUES ):
183
174
# Draft PEPs have no status displayed, Active shares a key with Accepted
184
175
if status in HIDE_STATUS :
@@ -195,7 +186,7 @@ def write_pep0(self, peps: list[PEP]):
195
186
# PEP owners
196
187
authors_dict = _verify_email_addresses (peps )
197
188
max_name_len = max (len (author_name ) for author_name in authors_dict )
198
- self .emit_title ("Authors/Owners" , "authors" )
189
+ self .emit_title ("Authors/Owners" )
199
190
self .emit_author_table_separator (max_name_len )
200
191
self .emit_text (f"{ 'Name' :{max_name_len }} Email Address" )
201
192
self .emit_author_table_separator (max_name_len )
@@ -207,10 +198,6 @@ def write_pep0(self, peps: list[PEP]):
207
198
self .emit_newline ()
208
199
self .emit_newline ()
209
200
210
- # References for introduction footnotes
211
- self .emit_title ("References" , "references" )
212
- self .emit_text (references )
213
-
214
201
pep0_string = "\n " .join ([str (s ) for s in self .output ])
215
202
return pep0_string
216
203
0 commit comments