Revision: 3624
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3624&view=rev
Author: efiring
Date: 2007-07-27 16:34:29 -0700 (Fri, 27 Jul 2007)
Log Message:
-----------
tweaked cbook.dedent, inspired by Fernando's version
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/cbook.py
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py 2007-07-27 15:45:26 UTC (rev
3623)
+++ trunk/matplotlib/lib/matplotlib/cbook.py 2007-07-27 23:34:29 UTC (rev
3624)
@@ -543,6 +543,8 @@
first line. It differs from textwrap.dedent in its
deletion of leading blank lines and its use of the
first non-blank line to determine the indentation.
+
+ It is also faster in most cases.
"""
if not s: # includes case of s is None
return ''
@@ -552,6 +554,9 @@
ii += 1
lines = lines[ii:]
nshift = len(lines[0]) - len(lines[0].lstrip())
+ # Don't use first line in case of """blah...
+ if ii == 0 and len(lines) > 1:
+ nshift = len(lines[1]) - len(lines[1].lstrip())
for i, line in enumerate(lines):
nwhite = len(line) - len(line.lstrip())
lines[i] = line[min(nshift, nwhite):]
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins