##// END OF EJS Templates
DOC: More autoreformatting of docstrings....
Matthias Bussonnier -
Show More
@@ -146,7 +146,7 b' class DisplayHook(Configurable):'
146 MIME type representation of the object.
146 MIME type representation of the object.
147 md_dict is a :class:`dict` with the same MIME type keys
147 md_dict is a :class:`dict` with the same MIME type keys
148 of metadata associated with each output.
148 of metadata associated with each output.
149
149
150 """
150 """
151 return self.shell.display_formatter.format(result)
151 return self.shell.display_formatter.format(result)
152
152
@@ -94,11 +94,11 b' class DisplayPublisher(Configurable):'
94 the data itself.
94 the data itself.
95 source : str, deprecated
95 source : str, deprecated
96 Unused.
96 Unused.
97 transient: dict, keyword-only
97 transient : dict, keyword-only
98 A dictionary for transient data.
98 A dictionary for transient data.
99 Data in this dictionary should not be persisted as part of saving this output.
99 Data in this dictionary should not be persisted as part of saving this output.
100 Examples include 'display_id'.
100 Examples include 'display_id'.
101 update: bool, keyword-only, default: False
101 update : bool, keyword-only, default: False
102 If True, only update existing outputs with the same display_id,
102 If True, only update existing outputs with the same display_id,
103 rather than creating a new output.
103 rather than creating a new output.
104 """
104 """
@@ -28,34 +28,34 b' class EventManager(object):'
28 """
28 """
29 def __init__(self, shell, available_events):
29 def __init__(self, shell, available_events):
30 """Initialise the :class:`CallbackManager`.
30 """Initialise the :class:`CallbackManager`.
31
31
32 Parameters
32 Parameters
33 ----------
33 ----------
34 shell
34 shell
35 The :class:`~IPython.core.interactiveshell.InteractiveShell` instance
35 The :class:`~IPython.core.interactiveshell.InteractiveShell` instance
36 available_callbacks
36 available_events
37 An iterable of names for callback events.
37 An iterable of names for callback events.
38 """
38 """
39 self.shell = shell
39 self.shell = shell
40 self.callbacks = {n:[] for n in available_events}
40 self.callbacks = {n:[] for n in available_events}
41
41
42 def register(self, event, function):
42 def register(self, event, function):
43 """Register a new event callback.
43 """Register a new event callback.
44
44
45 Parameters
45 Parameters
46 ----------
46 ----------
47 event : str
47 event : str
48 The event for which to register this callback.
48 The event for which to register this callback.
49 function : callable
49 function : callable
50 A function to be called on the given event. It should take the same
50 A function to be called on the given event. It should take the same
51 parameters as the appropriate callback prototype.
51 parameters as the appropriate callback prototype.
52
52
53 Raises
53 Raises
54 ------
54 ------
55 TypeError
55 TypeError
56 If ``function`` is not callable.
56 If ``function`` is not callable.
57 KeyError
57 KeyError
58 If ``event`` is not one of the known events.
58 If ``event`` is not one of the known events.
59 """
59 """
60 if not callable(function):
60 if not callable(function):
61 raise TypeError('Need a callable, got %r' % function)
61 raise TypeError('Need a callable, got %r' % function)
@@ -80,7 +80,7 b' class EventManager(object):'
80
80
81 def trigger(self, event, *args, **kwargs):
81 def trigger(self, event, *args, **kwargs):
82 """Call callbacks for ``event``.
82 """Call callbacks for ``event``.
83
83
84 Any additional arguments are passed to all callbacks registered for this
84 Any additional arguments are passed to all callbacks registered for this
85 event. Exceptions raised by callbacks are caught, and a message printed.
85 event. Exceptions raised by callbacks are caught, and a message printed.
86 """
86 """
@@ -109,7 +109,7 b' def _define_event(callback_function):'
109 @_define_event
109 @_define_event
110 def pre_execute():
110 def pre_execute():
111 """Fires before code is executed in response to user/frontend action.
111 """Fires before code is executed in response to user/frontend action.
112
112
113 This includes comm and widget messages and silent execution, as well as user
113 This includes comm and widget messages and silent execution, as well as user
114 code cells.
114 code cells.
115 """
115 """
@@ -122,14 +122,14 b' def pre_run_cell(info):'
122 Parameters
122 Parameters
123 ----------
123 ----------
124 info : :class:`~IPython.core.interactiveshell.ExecutionInfo`
124 info : :class:`~IPython.core.interactiveshell.ExecutionInfo`
125 An object containing information used for the code execution.
125 An object containing information used for the code execution.
126 """
126 """
127 pass
127 pass
128
128
129 @_define_event
129 @_define_event
130 def post_execute():
130 def post_execute():
131 """Fires after code is executed in response to user/frontend action.
131 """Fires after code is executed in response to user/frontend action.
132
132
133 This includes comm and widget messages and silent execution, as well as user
133 This includes comm and widget messages and silent execution, as well as user
134 code cells.
134 code cells.
135 """
135 """
@@ -142,20 +142,20 b' def post_run_cell(result):'
142 Parameters
142 Parameters
143 ----------
143 ----------
144 result : :class:`~IPython.core.interactiveshell.ExecutionResult`
144 result : :class:`~IPython.core.interactiveshell.ExecutionResult`
145 The object which will be returned as the execution result.
145 The object which will be returned as the execution result.
146 """
146 """
147 pass
147 pass
148
148
149 @_define_event
149 @_define_event
150 def shell_initialized(ip):
150 def shell_initialized(ip):
151 """Fires after initialisation of :class:`~IPython.core.interactiveshell.InteractiveShell`.
151 """Fires after initialisation of :class:`~IPython.core.interactiveshell.InteractiveShell`.
152
152
153 This is before extensions and startup scripts are loaded, so it can only be
153 This is before extensions and startup scripts are loaded, so it can only be
154 set by subclassing.
154 set by subclassing.
155
155
156 Parameters
156 Parameters
157 ----------
157 ----------
158 ip : :class:`~IPython.core.interactiveshell.InteractiveShell`
158 ip : :class:`~IPython.core.interactiveshell.InteractiveShell`
159 The newly initialised shell.
159 The newly initialised shell.
160 """
160 """
161 pass
161 pass
@@ -94,7 +94,7 b' class ExtensionManager(Configurable):'
94
94
95 This function looks up the extension's name in ``sys.modules`` and
95 This function looks up the extension's name in ``sys.modules`` and
96 simply calls ``mod.unload_ipython_extension(self)``.
96 simply calls ``mod.unload_ipython_extension(self)``.
97
97
98 Returns the string "no unload function" if the extension doesn't define
98 Returns the string "no unload function" if the extension doesn't define
99 a function to unload itself, "not loaded" if the extension isn't loaded,
99 a function to unload itself, "not loaded" if the extension isn't loaded,
100 otherwise None.
100 otherwise None.
@@ -121,19 +121,17 b' class DisplayFormatter(Configurable):'
121 Returns
121 Returns
122 -------
122 -------
123 (format_dict, metadata_dict) : tuple of two dicts
123 (format_dict, metadata_dict) : tuple of two dicts
124
125 format_dict is a dictionary of key/value pairs, one of each format that was
124 format_dict is a dictionary of key/value pairs, one of each format that was
126 generated for the object. The keys are the format types, which
125 generated for the object. The keys are the format types, which
127 will usually be MIME type strings and the values and JSON'able
126 will usually be MIME type strings and the values and JSON'able
128 data structure containing the raw data for the representation in
127 data structure containing the raw data for the representation in
129 that format.
128 that format.
130
129
131 metadata_dict is a dictionary of metadata about each mime-type output.
130 metadata_dict is a dictionary of metadata about each mime-type output.
132 Its keys will be a strict subset of the keys in format_dict.
131 Its keys will be a strict subset of the keys in format_dict.
133
132
134 Notes
133 Notes
135 -----
134 -----
136
137 If an object implement `_repr_mimebundle_` as well as various
135 If an object implement `_repr_mimebundle_` as well as various
138 `_repr_*_`, the data returned by `_repr_mimebundle_` will take
136 `_repr_*_`, the data returned by `_repr_mimebundle_` will take
139 precedence and the corresponding `_repr_*_` for this mimetype will
137 precedence and the corresponding `_repr_*_` for this mimetype will
@@ -263,7 +261,7 b' class FormatterABC(metaclass=abc.ABCMeta):'
263
261
264 def _mod_name_key(typ):
262 def _mod_name_key(typ):
265 """Return a (__module__, __name__) tuple for a type.
263 """Return a (__module__, __name__) tuple for a type.
266
264
267 Used as key in Formatter.deferred_printers.
265 Used as key in Formatter.deferred_printers.
268 """
266 """
269 module = getattr(typ, '__module__', None)
267 module = getattr(typ, '__module__', None)
@@ -358,7 +356,7 b' class BaseFormatter(Configurable):'
358
356
359 def _check_return(self, r, obj):
357 def _check_return(self, r, obj):
360 """Check that a return value is appropriate
358 """Check that a return value is appropriate
361
359
362 Return the value if so, None otherwise, warning if invalid.
360 Return the value if so, None otherwise, warning if invalid.
363 """
361 """
364 if r is None or isinstance(r, self._return_type) or \
362 if r is None or isinstance(r, self._return_type) or \
@@ -373,10 +371,10 b' class BaseFormatter(Configurable):'
373
371
374 def lookup(self, obj):
372 def lookup(self, obj):
375 """Look up the formatter for a given instance.
373 """Look up the formatter for a given instance.
376
374
377 Parameters
375 Parameters
378 ----------
376 ----------
379 obj : object instance
377 obj : object instance
380
378
381 Returns
379 Returns
382 -------
380 -------
@@ -399,7 +397,7 b' class BaseFormatter(Configurable):'
399
397
400 Parameters
398 Parameters
401 ----------
399 ----------
402 typ : type or '__module__.__name__' string for a type
400 typ : type or '__module__.__name__' string for a type
403
401
404 Returns
402 Returns
405 -------
403 -------
@@ -430,7 +428,7 b' class BaseFormatter(Configurable):'
430
428
431 def for_type(self, typ, func=None):
429 def for_type(self, typ, func=None):
432 """Add a format function for a given type.
430 """Add a format function for a given type.
433
431
434 Parameters
432 Parameters
435 ----------
433 ----------
436 typ : type or '__module__.__name__' string for a type
434 typ : type or '__module__.__name__' string for a type
@@ -441,10 +439,10 b' class BaseFormatter(Configurable):'
441 and will return the raw data in this formatter's format.
439 and will return the raw data in this formatter's format.
442 Subclasses may use a different call signature for the
440 Subclasses may use a different call signature for the
443 `func` argument.
441 `func` argument.
444
442
445 If `func` is None or not specified, there will be no change,
443 If `func` is None or not specified, there will be no change,
446 only returning the current value.
444 only returning the current value.
447
445
448 Returns
446 Returns
449 -------
447 -------
450 oldfunc : callable
448 oldfunc : callable
@@ -484,10 +482,10 b' class BaseFormatter(Configurable):'
484 and will return the raw data in this formatter's format.
482 and will return the raw data in this formatter's format.
485 Subclasses may use a different call signature for the
483 Subclasses may use a different call signature for the
486 `func` argument.
484 `func` argument.
487
485
488 If `func` is None or unspecified, there will be no change,
486 If `func` is None or unspecified, there will be no change,
489 only returning the current value.
487 only returning the current value.
490
488
491 Returns
489 Returns
492 -------
490 -------
493 oldfunc : callable
491 oldfunc : callable
@@ -827,7 +825,7 b' class JSONFormatter(BaseFormatter):'
827
825
828 def _check_return(self, r, obj):
826 def _check_return(self, r, obj):
829 """Check that a return value is appropriate
827 """Check that a return value is appropriate
830
828
831 Return the value if so, None otherwise, warning if invalid.
829 Return the value if so, None otherwise, warning if invalid.
832 """
830 """
833 if r is None:
831 if r is None:
@@ -1,2 +1,7 b''
1 [metadata]
1 [metadata]
2 license_file = LICENSE
2 license_file = LICENSE
3
4 [velin]
5 ignore_patterns =
6 IPython/core/tests,
7 IPython/testing
General Comments 0
You need to be logged in to leave comments. Login now