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