SourceForge logo
SourceForge logo
Menu

matplotlib-checkins

From: <ef...@us...> - 2007年07月27日 23:34:33
Revision: 3624
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3624&view=rev
Author: efiring
Date: 2007年07月27日 16:34:29 -0700 (2007年7月27日)
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.
From: <md...@us...> - 2007年08月23日 17:59:23
Revision: 3733
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3733&view=rev
Author: mdboom
Date: 2007年08月23日 10:59:21 -0700 (2007年8月23日)
Log Message:
-----------
Extremely minor bugfix that prevents the cycle finder from printing
out dictionaries.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/cbook.py
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py	2007年08月23日 17:58:49 UTC (rev 3732)
+++ trunk/matplotlib/lib/matplotlib/cbook.py	2007年08月23日 17:59:21 UTC (rev 3733)
@@ -936,7 +936,7 @@
 recurse(referent, start, all, current_path + [obj])
 
 for obj in objects:
- outstream.write("Examining: %r\n" % obj)
+ outstream.write("Examining: %r\n" % (obj,))
 recurse(obj, obj, { }, [])
 
 if __name__=='__main__':
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年08月28日 19:20:13
Revision: 3745
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3745&view=rev
Author: mdboom
Date: 2007年08月28日 12:20:08 -0700 (2007年8月28日)
Log Message:
-----------
Oops in last commit.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/cbook.py
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py	2007年08月28日 19:17:21 UTC (rev 3744)
+++ trunk/matplotlib/lib/matplotlib/cbook.py	2007年08月28日 19:20:08 UTC (rev 3745)
@@ -572,7 +572,7 @@
 # Get a regex that will remove *up to* nshift spaces from the
 # beginning of each line. If it isn't in the cache, generate it.
 unindent = _dedent_regex.get(nshift, None)
- if unindent = None
+ if unindent is None:
 unindent = re.compile("\n\r?" + " ?" * nshift)
 _dedent_regex[nshift] = unindent
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年08月28日 19:49:33
Revision: 3746
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3746&view=rev
Author: mdboom
Date: 2007年08月28日 12:49:29 -0700 (2007年8月28日)
Log Message:
-----------
A further optimization of the new dedent.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/cbook.py
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py	2007年08月28日 19:20:08 UTC (rev 3745)
+++ trunk/matplotlib/lib/matplotlib/cbook.py	2007年08月28日 19:49:29 UTC (rev 3746)
@@ -573,10 +573,11 @@
 # beginning of each line. If it isn't in the cache, generate it.
 unindent = _dedent_regex.get(nshift, None)
 if unindent is None:
- unindent = re.compile("\n\r?" + " ?" * nshift)
+ unindent = re.compile("\n\r? {0,%d}" % nshift)
 _dedent_regex[nshift] = unindent
 
 result = unindent.sub("\n", s).strip()
+ print result
 return result
 
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年08月28日 19:50:03
Revision: 3747
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3747&view=rev
Author: mdboom
Date: 2007年08月28日 12:49:53 -0700 (2007年8月28日)
Log Message:
-----------
A further optimization of the new dedent.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/cbook.py
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py	2007年08月28日 19:49:29 UTC (rev 3746)
+++ trunk/matplotlib/lib/matplotlib/cbook.py	2007年08月28日 19:49:53 UTC (rev 3747)
@@ -577,7 +577,6 @@
 _dedent_regex[nshift] = unindent
 
 result = unindent.sub("\n", s).strip()
- print result
 return result
 
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2008年07月03日 16:09:29
Revision: 5711
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5711&view=rev
Author: mdboom
Date: 2008年07月03日 09:08:52 -0700 (2008年7月03日)
Log Message:
-----------
O(n) implementation of Grouper.__iter__
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/cbook.py
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py	2008年07月03日 14:30:41 UTC (rev 5710)
+++ trunk/matplotlib/lib/matplotlib/cbook.py	2008年07月03日 16:08:52 UTC (rev 5711)
@@ -1030,7 +1030,7 @@
 >>> g.join('a', 'b')
 >>> g.join('b', 'c')
 >>> g.join('d', 'e')
- >>> list(g.get())
+ >>> list(g)
 [['a', 'b', 'c'], ['d', 'e']]
 >>> g.joined('a', 'b')
 True
@@ -1079,14 +1079,25 @@
 
 def __iter__(self):
 """
- Returns an iterator yielding each of the disjoint sets as a list.
+ Iterate over each of the disjoint sets as a list.
+
+ The iterator is invalid if interleaved with calls to join().
 """
- seen = set()
- for elem, group in self._mapping.iteritems():
- if elem not in seen:
+ class Token: pass
+ token = Token()
+
+ # Mark each group as we come across if by appending a token,
+ # and don't yield it twice
+ for group in self._mapping.itervalues():
+ if not group[-1] is token:
 yield group
- seen.update(group)
+ group.append(token)
 
+ # Cleanup the tokens
+ for group in self._mapping.itervalues():
+ if group[-1] is token:
+ del group[-1]
+
 def get_siblings(self, a):
 """
 Returns all of the items joined with *a*, including itself.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

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