##// END OF EJS Templates
some docstring reformatting and fixing
Matthias Bussonnier -
Show More
@@ -32,6 +32,8 b' from IPython.utils.py3compat import input'
32
32
33 from IPython.core.release import __version__ as version
33 from IPython.core.release import __version__ as version
34
34
35 from typing import Optional
36
35 #-----------------------------------------------------------------------------
37 #-----------------------------------------------------------------------------
36 # Code
38 # Code
37 #-----------------------------------------------------------------------------
39 #-----------------------------------------------------------------------------
@@ -95,8 +97,15 b' class CrashHandler(object):'
95 message_template = _default_message_template
97 message_template = _default_message_template
96 section_sep = '\n\n'+'*'*75+'\n\n'
98 section_sep = '\n\n'+'*'*75+'\n\n'
97
99
98 def __init__(self, app, contact_name=None, contact_email=None,
100 def __init__(
99 bug_tracker=None, show_crash_traceback=True, call_pdb=False):
101 self,
102 app,
103 contact_name: Optional[str] = None,
104 contact_email: Optional[str] = None,
105 bug_tracker: Optional[str] = None,
106 show_crash_traceback: bool = True,
107 call_pdb: bool = False,
108 ):
100 """Create a new crash handler
109 """Create a new crash handler
101
110
102 Parameters
111 Parameters
@@ -113,10 +122,15 b' class CrashHandler(object):'
113 show_crash_traceback : bool
122 show_crash_traceback : bool
114 If false, don't print the crash traceback on stderr, only generate
123 If false, don't print the crash traceback on stderr, only generate
115 the on-disk report
124 the on-disk report
116 Non-argument instance attributes
125 call_pdb
126 Whether to call pdb on crash
127
128 Attributes
129 ----------
117 These instances contain some non-argument attributes which allow for
130 These instances contain some non-argument attributes which allow for
118 further customization of the crash handler's behavior. Please see the
131 further customization of the crash handler's behavior. Please see the
119 source for further details.
132 source for further details.
133
120 """
134 """
121 self.crash_report_fname = "Crash_report_%s.txt" % app.name
135 self.crash_report_fname = "Crash_report_%s.txt" % app.name
122 self.app = app
136 self.app = app
@@ -16,7 +16,7 b''
16
16
17 def get_ipython():
17 def get_ipython():
18 """Get the global InteractiveShell instance.
18 """Get the global InteractiveShell instance.
19
19
20 Returns None if no InteractiveShell instance is registered.
20 Returns None if no InteractiveShell instance is registered.
21 """
21 """
22 from IPython.core.interactiveshell import InteractiveShell
22 from IPython.core.interactiveshell import InteractiveShell
@@ -114,16 +114,13 b' def record_magic(dct, magic_kind, magic_name, func):'
114 Parameters
114 Parameters
115 ----------
115 ----------
116 dct : dict
116 dct : dict
117 A dictionary with 'line' and 'cell' subdicts.
117 A dictionary with 'line' and 'cell' subdicts.
118
119 magic_kind : str
118 magic_kind : str
120 Kind of magic to be stored.
119 Kind of magic to be stored.
121
122 magic_name : str
120 magic_name : str
123 Key to store the magic as.
121 Key to store the magic as.
124
125 func : function
122 func : function
126 Callable object to store.
123 Callable object to store.
127 """
124 """
128 if magic_kind == 'line_cell':
125 if magic_kind == 'line_cell':
129 dct['line'][magic_name] = dct['cell'][magic_name] = func
126 dct['line'][magic_name] = dct['cell'][magic_name] = func
@@ -372,7 +369,7 b' class MagicsManager(Configurable):'
372 def register(self, *magic_objects):
369 def register(self, *magic_objects):
373 """Register one or more instances of Magics.
370 """Register one or more instances of Magics.
374
371
375 Take one or more classes or instances of classes that subclass the main
372 Take one or more classes or instances of classes that subclass the main
376 `core.Magic` class, and register them with IPython to use the magic
373 `core.Magic` class, and register them with IPython to use the magic
377 functions they provide. The registration process will then ensure that
374 functions they provide. The registration process will then ensure that
378 any methods that have decorated to provide line and/or cell magics will
375 any methods that have decorated to provide line and/or cell magics will
@@ -387,7 +384,7 b' class MagicsManager(Configurable):'
387
384
388 Parameters
385 Parameters
389 ----------
386 ----------
390 magic_objects : one or more classes or instances
387 *magic_objects : one or more classes or instances
391 """
388 """
392 # Start by validating them to ensure they have all had their magic
389 # Start by validating them to ensure they have all had their magic
393 # methods registered at the instance level
390 # methods registered at the instance level
@@ -410,7 +407,7 b' class MagicsManager(Configurable):'
410
407
411 This will create an IPython magic (line, cell or both) from a
408 This will create an IPython magic (line, cell or both) from a
412 standalone function. The functions should have the following
409 standalone function. The functions should have the following
413 signatures:
410 signatures:
414
411
415 * For line magics: `def f(line)`
412 * For line magics: `def f(line)`
416 * For cell magics: `def f(line, cell)`
413 * For cell magics: `def f(line, cell)`
@@ -422,14 +419,12 b' class MagicsManager(Configurable):'
422 Parameters
419 Parameters
423 ----------
420 ----------
424 func : callable
421 func : callable
425 Function to be registered as a magic.
422 Function to be registered as a magic.
426
427 magic_kind : str
423 magic_kind : str
428 Kind of magic, one of 'line', 'cell' or 'line_cell'
424 Kind of magic, one of 'line', 'cell' or 'line_cell'
429
430 magic_name : optional str
425 magic_name : optional str
431 If given, the name the magic will have in the IPython namespace. By
426 If given, the name the magic will have in the IPython namespace. By
432 default, the name of the function itself is used.
427 default, the name of the function itself is used.
433 """
428 """
434
429
435 # Create the new method in the user_magics and register it in the
430 # Create the new method in the user_magics and register it in the
@@ -450,13 +445,11 b' class MagicsManager(Configurable):'
450 Parameters
445 Parameters
451 ----------
446 ----------
452 alias_name : str
447 alias_name : str
453 The name of the magic to be registered.
448 The name of the magic to be registered.
454
455 magic_name : str
449 magic_name : str
456 The name of an existing magic.
450 The name of an existing magic.
457
458 magic_kind : str
451 magic_kind : str
459 Kind of magic, one of 'line' or 'cell'
452 Kind of magic, one of 'line' or 'cell'
460 """
453 """
461
454
462 # `validate_type` is too permissive, as it allows 'line_cell'
455 # `validate_type` is too permissive, as it allows 'line_cell'
@@ -580,25 +573,20 b' class Magics(Configurable):'
580
573
581 Parameters
574 Parameters
582 ----------
575 ----------
583
584 arg_str : str
576 arg_str : str
585 The arguments to parse.
577 The arguments to parse.
586
587 opt_str : str
578 opt_str : str
588 The options specification.
579 The options specification.
589
590 mode : str, default 'string'
580 mode : str, default 'string'
591 If given as 'list', the argument string is returned as a list (split
581 If given as 'list', the argument string is returned as a list (split
592 on whitespace) instead of a string.
582 on whitespace) instead of a string.
593
594 list_all : bool, default False
583 list_all : bool, default False
595 Put all option values in lists. Normally only options
584 Put all option values in lists. Normally only options
596 appearing more than once are put in a list.
585 appearing more than once are put in a list.
597
598 posix : bool, default True
586 posix : bool, default True
599 Whether to split the input line in POSIX mode or not, as per the
587 Whether to split the input line in POSIX mode or not, as per the
600 conventions outlined in the :mod:`shlex` module from the standard
588 conventions outlined in the :mod:`shlex` module from the standard
601 library.
589 library.
602 """
590 """
603
591
604 # inject default options at the beginning of the input line
592 # inject default options at the beginning of the input line
@@ -46,7 +46,7 b' def display_page(strng, start=0, screen_lines=25):'
46
46
47 def as_hook(page_func):
47 def as_hook(page_func):
48 """Wrap a pager func to strip the `self` arg
48 """Wrap a pager func to strip the `self` arg
49
49
50 so it can be called as a hook.
50 so it can be called as a hook.
51 """
51 """
52 return lambda self, *args, **kwargs: page_func(*args, **kwargs)
52 return lambda self, *args, **kwargs: page_func(*args, **kwargs)
@@ -127,7 +127,7 b' def _detect_screen_size(screen_lines_def):'
127
127
128 def pager_page(strng, start=0, screen_lines=0, pager_cmd=None):
128 def pager_page(strng, start=0, screen_lines=0, pager_cmd=None):
129 """Display a string, piping through a pager after a certain length.
129 """Display a string, piping through a pager after a certain length.
130
130
131 strng can be a mime-bundle dict, supplying multiple representations,
131 strng can be a mime-bundle dict, supplying multiple representations,
132 keyed by mime-type.
132 keyed by mime-type.
133
133
@@ -238,10 +238,10 b' def pager_page(strng, start=0, screen_lines=0, pager_cmd=None):'
238
238
239 def page(data, start=0, screen_lines=0, pager_cmd=None):
239 def page(data, start=0, screen_lines=0, pager_cmd=None):
240 """Display content in a pager, piping through a pager after a certain length.
240 """Display content in a pager, piping through a pager after a certain length.
241
241
242 data can be a mime-bundle dict, supplying multiple representations,
242 data can be a mime-bundle dict, supplying multiple representations,
243 keyed by mime-type, or text.
243 keyed by mime-type, or text.
244
244
245 Pager is dispatched via the `show_in_pager` IPython hook.
245 Pager is dispatched via the `show_in_pager` IPython hook.
246 If no hook is registered, `pager_page` will be used.
246 If no hook is registered, `pager_page` will be used.
247 """
247 """
@@ -17,10 +17,9 b' def page(strng, start=0, screen_lines=0, pager_cmd=None):'
17 Parameters
17 Parameters
18 ----------
18 ----------
19 strng : str or mime-dict
19 strng : str or mime-dict
20 Text to page, or a mime-type keyed dict of already formatted data.
20 Text to page, or a mime-type keyed dict of already formatted data.
21
22 start : int
21 start : int
23 Starting line at which to place the display.
22 Starting line at which to place the display.
24 """
23 """
25
24
26 # Some routines may auto-compute start offsets incorrectly and pass a
25 # Some routines may auto-compute start offsets incorrectly and pass a
@@ -42,7 +41,7 b' def page(strng, start=0, screen_lines=0, pager_cmd=None):'
42
41
43 def install_payload_page():
42 def install_payload_page():
44 """DEPRECATED, use show_in_pager hook
43 """DEPRECATED, use show_in_pager hook
45
44
46 Install this version of page as IPython.core.page.page.
45 Install this version of page as IPython.core.page.page.
47 """
46 """
48 warnings.warn("""install_payload_page is deprecated.
47 warnings.warn("""install_payload_page is deprecated.
@@ -185,8 +185,8 b' def mpl_runner(safe_execfile):'
185 Parameters
185 Parameters
186 ----------
186 ----------
187 safe_execfile : function
187 safe_execfile : function
188 This must be a function with the same interface as the
188 This must be a function with the same interface as the
189 :meth:`safe_execfile` method of IPython.
189 :meth:`safe_execfile` method of IPython.
190
190
191 Returns
191 Returns
192 -------
192 -------
@@ -241,7 +241,7 b' def select_figure_formats(shell, formats, **kwargs):'
241 """Select figure formats for the inline backend.
241 """Select figure formats for the inline backend.
242
242
243 Parameters
243 Parameters
244 ==========
244 ----------
245 shell : InteractiveShell
245 shell : InteractiveShell
246 The main IPython instance.
246 The main IPython instance.
247 formats : str or set
247 formats : str or set
@@ -408,7 +408,6 b' def configure_inline_support(shell, backend):'
408 Parameters
408 Parameters
409 ----------
409 ----------
410 shell : InteractiveShell instance
410 shell : InteractiveShell instance
411
412 backend : matplotlib backend
411 backend : matplotlib backend
413 """
412 """
414 warnings.warn(
413 warnings.warn(
@@ -556,7 +556,7 b' class ListTB(TBTools):'
556 Parameters
556 Parameters
557 ----------
557 ----------
558 etype : exception type
558 etype : exception type
559 evalue : exception value
559 value : exception value
560 """
560 """
561 return ListTB.structured_traceback(self, etype, value)
561 return ListTB.structured_traceback(self, etype, value)
562
562
General Comments 0
You need to be logged in to leave comments. Login now