Revision: 7905
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7905&view=rev
Author: jrevans
Date: 2009-10-23 17:44:29 +0000 (Fri, 23 Oct 2009)
Log Message:
-----------
Changed the algorithm that determines what converter to use for
unitized data to allow for strings and numpy arrays of types other
than 'object'. The new algorithm takes into account the
possibility of infinite recursion for strings or any other type.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/units.py
Modified: trunk/matplotlib/lib/matplotlib/units.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/units.py 2009-10-23 16:43:08 UTC (rev
7904)
+++ trunk/matplotlib/lib/matplotlib/units.py 2009-10-23 17:44:29 UTC (rev
7905)
@@ -128,18 +128,14 @@
if classx is not None:
converter = self.get(classx)
- # Check explicity for strings here because they would otherwise
- # lead to an infinite recursion, because a single character will
- # pass the iterable() check.
- if converter is None and iterable(x) and not is_string_like(x):
- # if this is anything but an object array, we'll assume
- # there are no custom units
- if isinstance(x, np.ndarray) and x.dtype != np.object:
- return None
-
+ if converter is None and iterable(x):
for thisx in x:
- converter = self.get_converter( thisx )
- return converter
+ # Make sure that recursing might actually lead to a solution,
if
+ # we are just going to re-examine another item of the same
kind,
+ # then do not look at it.
+ if classx and classx != getattr(thisx, '__class__', None):
+ converter = self.get_converter( thisx )
+ return converter
#DISABLED self._cached[idx] = converter
return converter
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins