@@ -224,45 +224,55 @@ def __doc__(self):
224224 opts_list = opts_list )
225225
226226_get_option_tmpl = """
227- get_option(pat) - Retrieves the value of the specified option
227+ get_option(pat)
228+
229+ Retrieves the value of the specified option.
228230
229231Available options:
232+
230233{opts_list}
231234
232235Parameters
233236----------
234- pat - str/regexp which should match a single option.
235-
236- Note: partial matches are supported for convenience, but unless you use the
237- full option name (e.g. x.y.z.option_name), your code may break in future
238- versions if new options with similar names are introduced.
237+ pat : str
238+ Regexp which should match a single option.
239+ Note: partial matches are supported for convenience, but unless you use the
240+ full option name (e.g. x.y.z.option_name), your code may break in future
241+ versions if new options with similar names are introduced.
239242
240243Returns
241244-------
242- result - the value of the option
245+ result : the value of the option
243246
244247Raises
245248------
246- OptionError if no such option exists
249+ OptionError : if no such option exists
250+
251+ Notes
252+ -----
253+ The available options with its descriptions:
247254
248255{opts_desc}
249256"""
250257
251258_set_option_tmpl = """
252- set_option(pat,value) - Sets the value of the specified option
259+ set_option(pat, value)
260+
261+ Sets the value of the specified option.
253262
254263Available options:
264+
255265{opts_list}
256266
257267Parameters
258268----------
259- pat - str/regexp which should match a single option.
260-
261- Note: partial matches are supported for convenience, but unless you use the
262- full option name (e.g. x.y.z.option_name), your code may break in future
263- versions if new options with similar names are introduced.
264-
265- value - new value of option.
269+ pat : str
270+ Regexp which should match a single option.
271+ Note: partial matches are supported for convenience, but unless you use the
272+ full option name (e.g. x.y.z.option_name), your code may break in future
273+ versions if new options with similar names are introduced.
274+ value :
275+ new value of option.
266276
267277Returns
268278-------
@@ -272,55 +282,72 @@ def __doc__(self):
272282------
273283OptionError if no such option exists
274284
285+ Notes
286+ -----
287+ The available options with its descriptions:
288+
275289{opts_desc}
276290"""
277291
278292_describe_option_tmpl = """
279- describe_option(pat,_print_desc=False) Prints the description
280- for one or more registered options.
293+ describe_option(pat, _print_desc=False)
294+
295+ Prints the description for one or more registered options.
281296
282297Call with not arguments to get a listing for all registered options.
283298
284299Available options:
300+
285301{opts_list}
286302
287303Parameters
288304----------
289- pat - str, a regexp pattern. All matching keys will have their
290- description displayed.
291-
292- _print_desc - if True (default) the description(s) will be printed
293- to stdout otherwise , the description(s) will be returned
294- as a unicode string (for testing).
305+ pat : str
306+ Regexp pattern. All matching keys will have their description displayed.
307+ _print_desc : bool, default True
308+ If True (default) the description(s) will be printed to stdout.
309+ Otherwise , the description(s) will be returned as a unicode string
310+ (for testing).
295311
296312Returns
297313-------
298314None by default, the description(s) as a unicode string if _print_desc
299315is False
300316
317+ Notes
318+ -----
319+ The available options with its descriptions:
320+
301321{opts_desc}
302322"""
303323
304324_reset_option_tmpl = """
305- reset_option(pat) - Reset one or more options to their default value.
325+ reset_option(pat)
326+
327+ Reset one or more options to their default value.
306328
307329Pass "all" as argument to reset all options.
308330
309331Available options:
332+
310333{opts_list}
311334
312335Parameters
313336----------
314- pat - str/regex if specified only options matching `prefix`* will be reset
315-
316- Note: partial matches are supported for convenience, but unless you use the
317- full option name (e.g. x.y.z.option_name), your code may break in future
318- versions if new options with similar names are introduced.
337+ pat : str/regex
338+ If specified only options matching `prefix*` will be reset.
339+ Note: partial matches are supported for convenience, but unless you
340+ use the full option name (e.g. x.y.z.option_name), your code may break
341+ in future versions if new options with similar names are introduced.
319342
320343Returns
321344-------
322345None
323346
347+ Notes
348+ -----
349+ The available options with its descriptions:
350+
324351{opts_desc}
325352"""
326353
@@ -337,6 +364,18 @@ def __doc__(self):
337364
338365
339366class option_context (object ):
367+ """
368+ Context manager to temporarily set options in the `with` statement context.
369+
370+ You need to invoke as ``option_context(pat, val, [(pat, val), ...])``.
371+
372+ Examples
373+ --------
374+
375+ >>> with option_context('display.max_rows', 10, 'display.max_columns', 5):
376+ ...
377+
378+ """
340379
341380 def __init__ (self , * args ):
342381 if not (len (args ) % 2 == 0 and len (args ) >= 2 ):
@@ -589,13 +628,13 @@ def _build_option_description(k):
589628 o = _get_registered_option (k )
590629 d = _get_deprecated_option (k )
591630
592- s = u ('%s: ' ) % k
631+ s = u ('%s : ' ) % k
593632 if o :
594633 s += u ('[default: %s] [currently: %s]' ) % (o .defval ,
595634 _get_option (k , True ))
596635
597636 if o .doc :
598- s += '\n ' + ' \n ' .join (o .doc .strip ().split ('\n ' ))
637+ s += '\n ' .join (o .doc .strip ().split ('\n ' ))
599638 else :
600639 s += 'No description available.\n '
601640
@@ -604,7 +643,7 @@ def _build_option_description(k):
604643 s += (u (', use `%s` instead.' ) % d .rkey if d .rkey else '' )
605644 s += u (')\n ' )
606645
607- s += '\n '
646+ s += '\n \n '
608647 return s
609648
610649
@@ -615,9 +654,9 @@ def pp_options_list(keys, width=80, _print=False):
615654 from itertools import groupby
616655
617656 def pp (name , ks ):
618- pfx = (name + '.[' if name else '' )
657+ pfx = ('- ' + name + '.[' if name else '' )
619658 ls = wrap (', ' .join (ks ), width , initial_indent = pfx ,
620- subsequent_indent = ' ' * len ( pfx ) , break_long_words = False )
659+ subsequent_indent = ' ' , break_long_words = False )
621660 if ls and ls [- 1 ] and name :
622661 ls [- 1 ] = ls [- 1 ] + ']'
623662 return ls
0 commit comments