3636# appended
3737PYPLOT_MAGIC_HEADER = '################# REMAINING CONTENT GENERATED BY boilerplate.py ##############\n '
3838
39- PYPLOT_PATH = os .path .join (os .path .dirname (__file__ ), 'lib' ,
40- 'matplotlib' , 'pyplot.py' )
39+ PYPLOT_PATH = os .path .join (os .path .dirname (__file__ ), 'lib' , 'matplotlib' ,
40+ 'pyplot.py' )
4141
4242
4343AUTOGEN_MSG = """
@@ -150,7 +150,7 @@ def boilerplate_gen():
150150 'vlines' ,
151151 'xcorr' ,
152152 'barbs' ,
153- )
153+ )
154154
155155 _misccommands = (
156156 'cla' ,
@@ -164,25 +164,24 @@ def boilerplate_gen():
164164 'tick_params' ,
165165 'margins' ,
166166 'autoscale' ,
167- )
167+ )
168168
169169 cmappable = {
170- 'contour' : 'if %(ret)s._A is not None: sci(%(ret)s)' ,
170+ 'contour' : 'if %(ret)s._A is not None: sci(%(ret)s)' ,
171171 'contourf' : 'if %(ret)s._A is not None: sci(%(ret)s)' ,
172- 'hexbin' : 'sci(%(ret)s)' ,
173- 'scatter' : 'sci(%(ret)s)' ,
174- 'pcolor' : 'sci(%(ret)s)' ,
172+ 'hexbin' : 'sci(%(ret)s)' ,
173+ 'scatter' : 'sci(%(ret)s)' ,
174+ 'pcolor' : 'sci(%(ret)s)' ,
175175 'pcolormesh' : 'sci(%(ret)s)' ,
176- 'hist2d' : 'sci(%(ret)s[-1])' ,
177- 'imshow' : 'sci(%(ret)s)' ,
176+ 'hist2d' : 'sci(%(ret)s[-1])' ,
177+ 'imshow' : 'sci(%(ret)s)' ,
178178 #'spy' : 'sci(%(ret)s)', ### may return image or Line2D
179- 'quiver' : 'sci(%(ret)s)' ,
180- 'specgram' : 'sci(%(ret)s[-1])' ,
181- 'streamplot' : 'sci(%(ret)s.lines)' ,
182- 'tricontour' : 'if %(ret)s._A is not None: sci(%(ret)s)' ,
179+ 'quiver' : 'sci(%(ret)s)' ,
180+ 'specgram' : 'sci(%(ret)s[-1])' ,
181+ 'streamplot' : 'sci(%(ret)s.lines)' ,
182+ 'tricontour' : 'if %(ret)s._A is not None: sci(%(ret)s)' ,
183183 'tricontourf' : 'if %(ret)s._A is not None: sci(%(ret)s)' ,
184- 'tripcolor' : 'sci(%(ret)s)' ,
185-
184+ 'tripcolor' : 'sci(%(ret)s)' ,
186185 }
187186
188187 def format_value (value ):
@@ -196,9 +195,9 @@ def format_value(value):
196195 return '=mlab.' + value .__name__
197196 if value .__name__ == 'mean' :
198197 return '=np.' + value .__name__
199- raise ValueError (('default value %s unknown to boilerplate.' + \
198+ raise ValueError (('default value %s unknown to boilerplate.' +
200199 'formatvalue' ) % value )
201- return '=' + repr (value )
200+ return '=' + repr (value )
202201
203202 text_wrapper = textwrap .TextWrapper (break_long_words = False )
204203
@@ -214,7 +213,7 @@ def format_value(value):
214213
215214 # Get argspec of wrapped function
216215 args , varargs , varkw , defaults = inspect .getargspec (getattr (Axes , func ))
217- args .pop (0 ) # remove 'self' argument
216+ args .pop (0 ) # remove 'self' argument
218217 if defaults is None :
219218 defaults = ()
220219 else :
@@ -234,9 +233,9 @@ def format_value(value):
234233 call .append ('%s=%s' % (arg , arg ))
235234
236235 if varargs is not None :
237- call .append ('*' + varargs )
236+ call .append ('*' + varargs )
238237 if varkw is not None :
239- call .append ('**' + varkw )
238+ call .append ('**' + varkw )
240239 call = ', ' .join (call )
241240
242241 text_wrapper .width = 80 - 19 - len (func )
@@ -257,7 +256,7 @@ def format_value(value):
257256 # Now we can build the argspec for defining the wrapper
258257 argspec = inspect .formatargspec (args , varargs , varkw , defaults ,
259258 formatvalue = format_value )
260- argspec = argspec [1 :- 1 ] # remove parens
259+ argspec = argspec [1 :- 1 ] # remove parens
261260
262261 text_wrapper .width = 80 - 5 - len (func )
263262 join_with = '\n ' + ' ' * (5 + len (func ))
@@ -268,9 +267,9 @@ def format_value(value):
268267 washold , ret , ax = 'washold' , 'ret' , 'ax'
269268 bad = set (args ) | set ((varargs , varkw ))
270269 while washold in bad or ret in bad or ax in bad :
271- washold = 'washold' + str (random .randrange (10 ** 12 ))
272- ret = 'ret' + str (random .randrange (10 ** 12 ))
273- ax = 'ax' + str (random .randrange (10 ** 12 ))
270+ washold = 'washold' + str (random .randrange (10 ** 12 ))
271+ ret = 'ret' + str (random .randrange (10 ** 12 ))
272+ ax = 'ax' + str (random .randrange (10 ** 12 ))
274273
275274 # Since we can't avoid using some function names,
276275 # bail out if they are used as argument names
@@ -287,10 +286,10 @@ def format_value(value):
287286 'cool' ,
288287 'copper' ,
289288 'flag' ,
290- 'gray' ,
289+ 'gray' ,
291290 'hot' ,
292291 'hsv' ,
293- 'jet' ,
292+ 'jet' ,
294293 'pink' ,
295294 'prism' ,
296295 'spring' ,
@@ -305,15 +304,15 @@ def format_value(value):
305304 yield ''
306305 yield '_setup_pyplot_info_docstrings()'
307306
307+
308308def build_pyplot ():
309309 pyplot_path = os .path .join (os .path .dirname (__file__ ), 'lib' ,
310310 'matplotlib' , 'pyplot.py' )
311311
312312 pyplot_orig = open (pyplot_path , 'r' ).readlines ()
313313
314-
315314 try :
316- pyplot_orig = pyplot_orig [:pyplot_orig .index (PYPLOT_MAGIC_HEADER )+ 1 ]
315+ pyplot_orig = pyplot_orig [:pyplot_orig .index (PYPLOT_MAGIC_HEADER ) + 1 ]
317316 except IndexError :
318317 raise ValueError ('The pyplot.py file *must* have the exact line: %s' % PYPLOT_MAGIC_HEADER )
319318
0 commit comments