[Python-checkins] r55992 - in sandbox/trunk/pep0: NOTES pep0/output.py

brett.cannon python-checkins at python.org
Fri Jun 15 05:52:15 CEST 2007


Author: brett.cannon
Date: Fri Jun 15 05:52:05 2007
New Revision: 55992
Modified:
 sandbox/trunk/pep0/NOTES
 sandbox/trunk/pep0/pep0/output.py
Log:
Output author list.
Modified: sandbox/trunk/pep0/NOTES
==============================================================================
--- sandbox/trunk/pep0/NOTES	(original)
+++ sandbox/trunk/pep0/NOTES	Fri Jun 15 05:52:05 2007
@@ -4,15 +4,14 @@
 * Read PEPs as UTF-8.
 
 * Author/email list.
- + names
- + emails
+ + Fix loss of a single space when name contains an accented character.
 + Column headers.
 - Underline to length of author name or just column header like in
 rest of doc?
 
 * Verify PEP is well-formatted.
 + Values in fields correct.
- - All authors declared in authors.py.
+ - All authors declared in email list.
 + Formatting correct.
 - Plaintext.
 - reST.
Modified: sandbox/trunk/pep0/pep0/output.py
==============================================================================
--- sandbox/trunk/pep0/pep0/output.py	(original)
+++ sandbox/trunk/pep0/pep0/output.py	Fri Jun 15 05:52:05 2007
@@ -1,7 +1,8 @@
 """Code to handle the output of PEP 0."""
 from . import constants
-from .pep import PEP
+from .pep import PEP, last_name
 
+from operator import itemgetter
 from sys import stdout
 
 
@@ -117,13 +118,27 @@
 print>>output
 print>>output, "Owners"
 print>>output
- # XXX
- # * get "last, first I." of each name.
- # * add nickname.
- # * find longest name.
- # * column headers.
- # * name/email with a two-space separation between longest name and email.
- print>>output, ' XXX'
+ max_name_len = len(max(constants.email_addresses, key=itemgetter(0)))
+ for name, nick in constants.nicknames.items():
+ name_nick_len = len(name) + len(nick) + 3 # Cover space and parens.
+ if name_nick_len > max_name_len:
+ max_name_len = name_nick_len
+ else:
+ max_name_len += 2 # Cover comma and space between last and first name.
+ print>>output, " %s %s" % ('name'.ljust(max_name_len), 'email address')
+ print>>output, " %s %s" % ((len('name')*'-').ljust(max_name_len),
+ len('email address')*'-')
+ for author, email in constants.email_addresses:
+ last_name_index = author.index(last_name(author))
+ first = author[:last_name_index].strip()
+ last = author[last_name_index:].strip()
+ if not first:
+ last_first = last
+ else:
+ last_first = ', '.join([last, first])
+ if author in constants.nicknames:
+ last_first += " (%s)" % constants.nicknames[author]
+ print>>output, " %s %s" % (last_first.ljust(max_name_len), email)
 print>>output
 print>>output
 print>>output, "References"


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /