1. Robot Mirror
  2. bugs.python.org

Commits

ezio.melotti  committed 36e532e

#399: automatically link to PEPs in the messages.

  • Participants
  • Parent commits f41b8b8
  • Branches default

Comments (0)

Files changed (2)

File extensions/local_replace.py

View file
  • Ignore whitespace
     return ('File "%s<a href="%s%s/Lib/%s#l%s">%s</a>", line %s' %
             (path, baseurl, branch, nfile, lnum, file, lnum))
 
+def make_pep_link(match):
+    text = match.group(0)
+    pepnum = match.group(1).zfill(4)
+    return '<a href="http://www.python.org/dev/peps/pep-%s/">%s</a>' % (pepnum, text)
+
 
 # these regexs have test in tests/test_local_replace.py
 
                 r'(?!.*site-packages)(python[\d.]*[/\\])?)(?P<file>[-.\w/\\]+?\.py))", '
                 r'line (?P<lnum>\d{1,5})'),
      make_traceback_link),
+
+    # PEP 8, PEP8, PEP 0008, ...
+    (re.compile(r'PEP\s*(\d{1,4})\b', re.I),
+     make_pep_link),
 ]
 
 

File extensions/test/local_replace_data.txt

View file
  • Ignore whitespace
 <a href="http://bugs.python.org/issue1000">http://bugs.python.org/issue1000</a>
 http://svn.python.org/view/python/branches/release26-maint/Lib/socket.py?r1=83624&r2=83623&pathrev=83624
 <a href="http://svn.python.org/view/python/branches/release26-maint/Lib/socket.py?r1=83624&amp;r2=83623&amp;pathrev=83624">http://svn.python.org/view/python/branches/release26-maint/Lib/socket.py?r1=83624&amp;r2=83623&amp;pathrev=83624</a>
+see http://www.python.org/dev/peps/pep-3127/#removal-of-old-octal-syntax
+see <a href="http://www.python.org/dev/peps/pep-3127/#removal-of-old-octal-syntax">http://www.python.org/dev/peps/pep-3127/#removal-of-old-octal-syntax</a>
+see http://docs.python.org/whatsnew/2.6.html#pep-371-the-multiprocessing-package
+see <a href="http://docs.python.org/whatsnew/2.6.html#pep-371-the-multiprocessing-package">http://docs.python.org/whatsnew/2.6.html#pep-371-the-multiprocessing-package</a>
 ##
 ## tracebacks
 File "/usr/lib/python2.7/socket.py", line 553, in create_connection
 see version1000.
 see version 1000.
 see version 1000.
+##
+##
+see PEP 8
+see <a href="http://www.python.org/dev/peps/pep-0008/">PEP 8</a>
+see PEP8
+see <a href="http://www.python.org/dev/peps/pep-0008/">PEP8</a>
+see pep 8
+see <a href="http://www.python.org/dev/peps/pep-0008/">pep 8</a>
+see PEP 008
+see <a href="http://www.python.org/dev/peps/pep-0008/">PEP 008</a>
+see PEP 3000
+see <a href="http://www.python.org/dev/peps/pep-3000/">PEP 3000</a>
+see PEP 15000
+see PEP 15000
+write a PEP!
+write a PEP!