From 9065df747f265f02502866869f329c1ccdf9e58d 2021-12-09 21:37:00 From: Matthias Bussonnier Date: 2021-12-09 21:37:00 Subject: [PATCH] Merge pull request #13388 from Carreau/reformat-docstring Reformat docstring and v8 what's new. --- diff --git a/IPython/core/completer.py b/IPython/core/completer.py index cc7b629..ccb1f46 100644 --- a/IPython/core/completer.py +++ b/IPython/core/completer.py @@ -462,7 +462,7 @@ def _deduplicate_completions(text: str, completions: _IC)-> _IC: seen.add(new_text) -def rectify_completions(text: str, completions: _IC, *, _debug=False)->_IC: +def rectify_completions(text: str, completions: _IC, *, _debug: bool = False) -> _IC: """ Rectify a set of completions to all have the same ``start`` and ``end`` @@ -479,6 +479,8 @@ def rectify_completions(text: str, completions: _IC, *, _debug=False)->_IC: text that should be completed. completions : Iterator[Completion] iterator over the completions to rectify + _debug : bool + Log failed completion Notes ----- @@ -1128,16 +1130,22 @@ class IPCompleter(Completer): secondary optional dict for completions, to handle cases (such as IPython embedded inside functions) where both Python scopes are visible. - use_readline : bool, optional - DEPRECATED, ignored since IPython 6.0, will have no effects + config : Config + traitlet's config object + **kwargs + passed to super class unmodified. """ self.magic_escape = ESC_MAGIC self.splitter = CompletionSplitter() # _greedy_changed() depends on splitter and readline being defined: - Completer.__init__(self, namespace=namespace, global_namespace=global_namespace, - config=config, **kwargs) + super().__init__( + namespace=namespace, + global_namespace=global_namespace, + config=config, + **kwargs + ) # List where completion matches will be stored self.matches = [] @@ -2055,9 +2063,9 @@ class IPCompleter(Completer): Parameters ---------- - cursor_line : + cursor_line Index of the line the cursor is on. 0 indexed. - cursor_pos : + cursor_pos Position of the cursor in the current line/line_buffer/text. 0 indexed. line_buffer : optional, str diff --git a/IPython/core/crashhandler.py b/IPython/core/crashhandler.py index 181fc15..d0d4b0d 100644 --- a/IPython/core/crashhandler.py +++ b/IPython/core/crashhandler.py @@ -32,6 +32,8 @@ from IPython.utils.py3compat import input from IPython.core.release import __version__ as version +from typing import Optional + #----------------------------------------------------------------------------- # Code #----------------------------------------------------------------------------- @@ -95,8 +97,15 @@ class CrashHandler(object): message_template = _default_message_template section_sep = '\n\n'+'*'*75+'\n\n' - def __init__(self, app, contact_name=None, contact_email=None, - bug_tracker=None, show_crash_traceback=True, call_pdb=False): + def __init__( + self, + app, + contact_name: Optional[str] = None, + contact_email: Optional[str] = None, + bug_tracker: Optional[str] = None, + show_crash_traceback: bool = True, + call_pdb: bool = False, + ): """Create a new crash handler Parameters @@ -113,10 +122,15 @@ class CrashHandler(object): show_crash_traceback : bool If false, don't print the crash traceback on stderr, only generate the on-disk report - Non-argument instance attributes + call_pdb + Whether to call pdb on crash + + Attributes + ---------- These instances contain some non-argument attributes which allow for further customization of the crash handler's behavior. Please see the source for further details. + """ self.crash_report_fname = "Crash_report_%s.txt" % app.name self.app = app diff --git a/IPython/core/debugger.py b/IPython/core/debugger.py index d3e4ec2..8e3dd96 100644 --- a/IPython/core/debugger.py +++ b/IPython/core/debugger.py @@ -798,7 +798,6 @@ class Pdb(OldPdb): def break_anywhere(self, frame): """ - _stop_in_decorator_internals is overly restrictive, as we may still want to trace function calls, so we need to also update break_anywhere so that is we don't `stop_here`, because of debugger skip, we may still @@ -820,8 +819,6 @@ class Pdb(OldPdb): """ Utility to tell us whether we are in a decorator internal and should stop. - - """ # if we are disabled don't skip diff --git a/IPython/core/display.py b/IPython/core/display.py index 310e2fa..f3934c2 100644 --- a/IPython/core/display.py +++ b/IPython/core/display.py @@ -826,15 +826,19 @@ class Image(DisplayObject): data : unicode, str or bytes The raw image data or a URL or filename to load the data from. This always results in embedded image data. + url : unicode A URL to download the data from. If you specify `url=`, the image data will not be embedded unless you also specify `embed=True`. + filename : unicode Path to a local file to load the data from. Images from a file are always embedded. + format : unicode The format of the image data (png/jpeg/jpg/gif). If a filename or URL is given for format will be inferred from the filename extension. + embed : bool Should the image data be embedded using a data URI (True) or be loaded using an tag. Set this to True if you want the image @@ -844,10 +848,13 @@ class Image(DisplayObject): default value is `False`. Note that QtConsole is not able to display images if `embed` is set to `False` + width : int Width in pixels to which to constrain the image in html + height : int Height in pixels to which to constrain the image in html + retina : bool Automatically set the width and height to half of the measured width and height. @@ -855,10 +862,13 @@ class Image(DisplayObject): from image data. For non-embedded images, you can just set the desired display width and height directly. + unconfined : bool Set unconfined=True to disable max-width confinement of the image. + metadata : dict Specify extra metadata to attach to the image. + alt : unicode Alternative text for the image, for use by screen readers. @@ -1067,12 +1077,15 @@ class Video(DisplayObject): data : unicode, str or bytes The raw video data or a URL or filename to load the data from. Raw data will require passing ``embed=True``. + url : unicode A URL for the video. If you specify ``url=``, the image data will not be embedded. + filename : unicode Path to a local file containing the video. Will be interpreted as a local URL unless ``embed=True``. + embed : bool Should the video be embedded using a data URI (True) or be loaded using a