Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f4b8992

Browse files
committed
comments in the coding guide review
svn path=/trunk/matplotlib/; revision=5480
1 parent af4d2f7 commit f4b8992

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

doc/devel/outline.rst

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,53 @@ include them as formal review notes.
168168
rc() function and using that instead of setting the
169169
dictionary entries directly), if necessary.
170170

171+
Darren notes:
172+
173+
Validation is actually built into RcParams. This was done
174+
just prior to development of the traited config, validation is done using
175+
the mechanisms developed in rcsetup. For example::
176+
177+
>>> rcParams['a.b']=1
178+
---------------------------------------------------------------------------
179+
KeyError Traceback (most recent call last)
180+
181+
/home/darren/<ipython console> in <module>()
182+
183+
/usr/lib64/python2.5/site-packages/matplotlib/__init__.pyc in __setitem__(self, key, val)
184+
555 except KeyError:
185+
556 raise KeyError('%s is not a valid rc parameter.\
186+
--> 557 See rcParams.keys() for a list of valid parameters.'%key)
187+
558
188+
559
189+
190+
KeyError: 'a.b is not a valid rc parameter.See rcParams.keys() for a list of valid parameters.'
191+
192+
also::
193+
194+
rcParams['text.usetex']=''
195+
---------------------------------------------------------------------------
196+
ValueError Traceback (most recent call last)
197+
198+
/home/darren/<ipython console> in <module>()
199+
200+
/usr/lib64/python2.5/site-packages/matplotlib/__init__.pyc in __setitem__(self, key, val)
201+
551 instead.'% (key, alt))
202+
552 key = alt
203+
--> 553 cval = self.validate[key](val)
204+
554 dict.__setitem__(self, key, cval)
205+
555 except KeyError:
206+
207+
/usr/lib64/python2.5/site-packages/matplotlib/rcsetup.pyc in validate_bool(b)
208+
56 elif b in ('f', 'n', 'no', 'off', 'false', '0', 0, False): return False
209+
57 else:
210+
---> 58 raise ValueError('Could not convert "%s" to boolean' % b)
211+
59
212+
60 def validate_bool_maybe_none(b):
213+
214+
ValueError: Could not convert "" to boolean
215+
216+
217+
171218
#. DONE - You give the example::
172219

173220
import matplotlib.cbook as cbook

0 commit comments

Comments
 (0)