[Python-checkins] r54267 - sandbox/trunk/pep0/TODO sandbox/trunk/pep0/pep0.py
brett.cannon
python-checkins at python.org
Sun Mar 11 01:07:49 CET 2007
Author: brett.cannon
Date: Sun Mar 11 01:07:49 2007
New Revision: 54267
Modified:
sandbox/trunk/pep0/TODO
sandbox/trunk/pep0/pep0.py
Log:
Initial attempt at outputting a PEP's line.
Modified: sandbox/trunk/pep0/TODO
==============================================================================
--- sandbox/trunk/pep0/TODO (original)
+++ sandbox/trunk/pep0/TODO Sun Mar 11 01:07:49 2007
@@ -1,4 +1,19 @@
In script:
+* Author issues
+ + Missing an author
+ - 207
+ - 208
+ - 209
+ - 218
+ - 228
+ - 234
+ - 238
+ - 246
+ - 251
+ - 263
+ - 312
+ - 314
+ + How to handle suffixes (Jr., etc.)?
* Read PEPs as UTF-8, not ASCII.
* Output static text for PEP 0.
+ Store Owners list in a data structure.
@@ -23,3 +38,5 @@
+ Add a "Meta" option for "Type"?
* Fix inconsistent usage of Status field.
+ Some PEPs just say "Standard"; missing "Track".
+* Informational, meta, and process PEPs inconsistently have status listed in
+ index.
Modified: sandbox/trunk/pep0/pep0.py
==============================================================================
--- sandbox/trunk/pep0/pep0.py (original)
+++ sandbox/trunk/pep0/pep0.py Sun Mar 11 01:07:49 2007
@@ -108,8 +108,35 @@
dead.append(pep)
return meta, info, accepted, open_, finished, empty, dead
+def write_pep(pep, output):
+ """Write PEP info to 'output'."""
+ type_abbr = pep['Type'][0].upper()
+ status = pep['Status']
+ if status == 'Draft' or type_abbr in ('I', 'P'):
+ status_abbr = ' '
+ else:
+ status_abbr = status[0].upper()
+ number = str(pep['PEP']).rjust(4)
+ title = pep['Title']
+ authors_list = []
+ for author in pep['Author']:
+ name_parts = author.split()
+ last_name = name_parts.pop()
+ try:
+ last_name_leader = name_parts.pop()
+ except IndexError:
+ pass
+ else:
+ if last_name_leader[0].islower():
+ last_name = '%s %s' % (last_name_leader, last_name)
+ authors_list.append(last_name)
+ authors = ', '.join(authors_list)
+ output.write(" %s%s %s %s %s\n" %
+ (type_abbr, status_abbr, number, title.ljust(44), authors))
+
+
if __name__ == '__main__':
- from sys import argv
+ from sys import argv, stdout
if not argv[1:]:
directory = '.'
@@ -117,9 +144,8 @@
directory = argv[1]
peps = consume_headers(directory)
- status = set()
- type_ = set()
+ output = stdout
for pep in peps:
- status.add(pep['Status'])
- type_.add(pep['Type'])
- meta, info, accepted, open_, done, empty, dead = sort_peps(peps)
+ write_pep(pep, output)
+
+ #meta, info, accepted, open_, done, empty, dead = sort_peps(peps)
More information about the Python-checkins
mailing list