From 7c853204ed0031a9b52bc45ce60ddc5fcbcf0bf6 2021-04-18 20:08:27 From: Matthias Bussonnier Date: 2021-04-18 20:08:27 Subject: [PATCH] DOC: More autoreformatting of docstrings. Also add some configuration to ignore some files. --- diff --git a/IPython/core/displayhook.py b/IPython/core/displayhook.py index 3c06675..578e783 100644 --- a/IPython/core/displayhook.py +++ b/IPython/core/displayhook.py @@ -146,7 +146,7 @@ class DisplayHook(Configurable): MIME type representation of the object. md_dict is a :class:`dict` with the same MIME type keys of metadata associated with each output. - + """ return self.shell.display_formatter.format(result) diff --git a/IPython/core/displaypub.py b/IPython/core/displaypub.py index 14719a2..74028ec 100644 --- a/IPython/core/displaypub.py +++ b/IPython/core/displaypub.py @@ -94,11 +94,11 @@ class DisplayPublisher(Configurable): the data itself. source : str, deprecated Unused. - transient: dict, keyword-only + transient : dict, keyword-only A dictionary for transient data. Data in this dictionary should not be persisted as part of saving this output. Examples include 'display_id'. - update: bool, keyword-only, default: False + update : bool, keyword-only, default: False If True, only update existing outputs with the same display_id, rather than creating a new output. """ diff --git a/IPython/core/events.py b/IPython/core/events.py index 1af13ca..73fc181 100644 --- a/IPython/core/events.py +++ b/IPython/core/events.py @@ -28,34 +28,34 @@ class EventManager(object): """ def __init__(self, shell, available_events): """Initialise the :class:`CallbackManager`. - + Parameters ---------- shell - The :class:`~IPython.core.interactiveshell.InteractiveShell` instance - available_callbacks - An iterable of names for callback events. + The :class:`~IPython.core.interactiveshell.InteractiveShell` instance + available_events + An iterable of names for callback events. """ self.shell = shell self.callbacks = {n:[] for n in available_events} def register(self, event, function): """Register a new event callback. - + Parameters ---------- event : str - The event for which to register this callback. + The event for which to register this callback. function : callable - A function to be called on the given event. It should take the same - parameters as the appropriate callback prototype. - + A function to be called on the given event. It should take the same + parameters as the appropriate callback prototype. + Raises ------ TypeError - If ``function`` is not callable. + If ``function`` is not callable. KeyError - If ``event`` is not one of the known events. + If ``event`` is not one of the known events. """ if not callable(function): raise TypeError('Need a callable, got %r' % function) @@ -80,7 +80,7 @@ class EventManager(object): def trigger(self, event, *args, **kwargs): """Call callbacks for ``event``. - + Any additional arguments are passed to all callbacks registered for this event. Exceptions raised by callbacks are caught, and a message printed. """ @@ -109,7 +109,7 @@ def _define_event(callback_function): @_define_event def pre_execute(): """Fires before code is executed in response to user/frontend action. - + This includes comm and widget messages and silent execution, as well as user code cells. """ @@ -122,14 +122,14 @@ def pre_run_cell(info): Parameters ---------- info : :class:`~IPython.core.interactiveshell.ExecutionInfo` - An object containing information used for the code execution. + An object containing information used for the code execution. """ pass @_define_event def post_execute(): """Fires after code is executed in response to user/frontend action. - + This includes comm and widget messages and silent execution, as well as user code cells. """ @@ -142,20 +142,20 @@ def post_run_cell(result): Parameters ---------- result : :class:`~IPython.core.interactiveshell.ExecutionResult` - The object which will be returned as the execution result. + The object which will be returned as the execution result. """ pass @_define_event def shell_initialized(ip): """Fires after initialisation of :class:`~IPython.core.interactiveshell.InteractiveShell`. - + This is before extensions and startup scripts are loaded, so it can only be set by subclassing. - + Parameters ---------- ip : :class:`~IPython.core.interactiveshell.InteractiveShell` - The newly initialised shell. + The newly initialised shell. """ pass diff --git a/IPython/core/extensions.py b/IPython/core/extensions.py index e570d48..db3b040 100644 --- a/IPython/core/extensions.py +++ b/IPython/core/extensions.py @@ -94,7 +94,7 @@ class ExtensionManager(Configurable): This function looks up the extension's name in ``sys.modules`` and simply calls ``mod.unload_ipython_extension(self)``. - + Returns the string "no unload function" if the extension doesn't define a function to unload itself, "not loaded" if the extension isn't loaded, otherwise None. diff --git a/IPython/core/formatters.py b/IPython/core/formatters.py index ab8172e..07efeca 100644 --- a/IPython/core/formatters.py +++ b/IPython/core/formatters.py @@ -121,19 +121,17 @@ class DisplayFormatter(Configurable): Returns ------- (format_dict, metadata_dict) : tuple of two dicts - format_dict is a dictionary of key/value pairs, one of each format that was generated for the object. The keys are the format types, which will usually be MIME type strings and the values and JSON'able data structure containing the raw data for the representation in that format. - + metadata_dict is a dictionary of metadata about each mime-type output. Its keys will be a strict subset of the keys in format_dict. Notes ----- - If an object implement `_repr_mimebundle_` as well as various `_repr_*_`, the data returned by `_repr_mimebundle_` will take precedence and the corresponding `_repr_*_` for this mimetype will @@ -263,7 +261,7 @@ class FormatterABC(metaclass=abc.ABCMeta): def _mod_name_key(typ): """Return a (__module__, __name__) tuple for a type. - + Used as key in Formatter.deferred_printers. """ module = getattr(typ, '__module__', None) @@ -358,7 +356,7 @@ class BaseFormatter(Configurable): def _check_return(self, r, obj): """Check that a return value is appropriate - + Return the value if so, None otherwise, warning if invalid. """ if r is None or isinstance(r, self._return_type) or \ @@ -373,10 +371,10 @@ class BaseFormatter(Configurable): def lookup(self, obj): """Look up the formatter for a given instance. - + Parameters ---------- - obj : object instance + obj : object instance Returns ------- @@ -399,7 +397,7 @@ class BaseFormatter(Configurable): Parameters ---------- - typ : type or '__module__.__name__' string for a type + typ : type or '__module__.__name__' string for a type Returns ------- @@ -430,7 +428,7 @@ class BaseFormatter(Configurable): def for_type(self, typ, func=None): """Add a format function for a given type. - + Parameters ---------- typ : type or '__module__.__name__' string for a type @@ -441,10 +439,10 @@ class BaseFormatter(Configurable): and will return the raw data in this formatter's format. Subclasses may use a different call signature for the `func` argument. - + If `func` is None or not specified, there will be no change, only returning the current value. - + Returns ------- oldfunc : callable @@ -484,10 +482,10 @@ class BaseFormatter(Configurable): and will return the raw data in this formatter's format. Subclasses may use a different call signature for the `func` argument. - + If `func` is None or unspecified, there will be no change, only returning the current value. - + Returns ------- oldfunc : callable @@ -827,7 +825,7 @@ class JSONFormatter(BaseFormatter): def _check_return(self, r, obj): """Check that a return value is appropriate - + Return the value if so, None otherwise, warning if invalid. """ if r is None: diff --git a/setup.cfg b/setup.cfg index 0c9e0fc..31a467c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,7 @@ [metadata] license_file = LICENSE + +[velin] +ignore_patterns = + IPython/core/tests, + IPython/testing