##// END OF EJS Templates
Merge pull request #13388 from Carreau/reformat-docstring...
Matthias Bussonnier -
r27298:9065df74 merge
parent child Browse files
Show More
@@ -462,7 +462,7 b' def _deduplicate_completions(text: str, completions: _IC)-> _IC:'
462 seen.add(new_text)
462 seen.add(new_text)
463
463
464
464
465 def rectify_completions(text: str, completions: _IC, *, _debug=False)->_IC:
465 def rectify_completions(text: str, completions: _IC, *, _debug: bool = False) -> _IC:
466 """
466 """
467 Rectify a set of completions to all have the same ``start`` and ``end``
467 Rectify a set of completions to all have the same ``start`` and ``end``
468
468
@@ -479,6 +479,8 b' def rectify_completions(text: str, completions: _IC, *, _debug=False)->_IC:'
479 text that should be completed.
479 text that should be completed.
480 completions : Iterator[Completion]
480 completions : Iterator[Completion]
481 iterator over the completions to rectify
481 iterator over the completions to rectify
482 _debug : bool
483 Log failed completion
482
484
483 Notes
485 Notes
484 -----
486 -----
@@ -1128,16 +1130,22 b' class IPCompleter(Completer):'
1128 secondary optional dict for completions, to
1130 secondary optional dict for completions, to
1129 handle cases (such as IPython embedded inside functions) where
1131 handle cases (such as IPython embedded inside functions) where
1130 both Python scopes are visible.
1132 both Python scopes are visible.
1131 use_readline : bool, optional
1133 config : Config
1132 DEPRECATED, ignored since IPython 6.0, will have no effects
1134 traitlet's config object
1135 **kwargs
1136 passed to super class unmodified.
1133 """
1137 """
1134
1138
1135 self.magic_escape = ESC_MAGIC
1139 self.magic_escape = ESC_MAGIC
1136 self.splitter = CompletionSplitter()
1140 self.splitter = CompletionSplitter()
1137
1141
1138 # _greedy_changed() depends on splitter and readline being defined:
1142 # _greedy_changed() depends on splitter and readline being defined:
1139 Completer.__init__(self, namespace=namespace, global_namespace=global_namespace,
1143 super().__init__(
1140 config=config, **kwargs)
1144 namespace=namespace,
1145 global_namespace=global_namespace,
1146 config=config,
1147 **kwargs
1148 )
1141
1149
1142 # List where completion matches will be stored
1150 # List where completion matches will be stored
1143 self.matches = []
1151 self.matches = []
@@ -2055,9 +2063,9 b' class IPCompleter(Completer):'
2055
2063
2056 Parameters
2064 Parameters
2057 ----------
2065 ----------
2058 cursor_line :
2066 cursor_line
2059 Index of the line the cursor is on. 0 indexed.
2067 Index of the line the cursor is on. 0 indexed.
2060 cursor_pos :
2068 cursor_pos
2061 Position of the cursor in the current line/line_buffer/text. 0
2069 Position of the cursor in the current line/line_buffer/text. 0
2062 indexed.
2070 indexed.
2063 line_buffer : optional, str
2071 line_buffer : optional, str
@@ -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
@@ -798,7 +798,6 b' class Pdb(OldPdb):'
798
798
799 def break_anywhere(self, frame):
799 def break_anywhere(self, frame):
800 """
800 """
801
802 _stop_in_decorator_internals is overly restrictive, as we may still want
801 _stop_in_decorator_internals is overly restrictive, as we may still want
803 to trace function calls, so we need to also update break_anywhere so
802 to trace function calls, so we need to also update break_anywhere so
804 that is we don't `stop_here`, because of debugger skip, we may still
803 that is we don't `stop_here`, because of debugger skip, we may still
@@ -820,8 +819,6 b' class Pdb(OldPdb):'
820 """
819 """
821 Utility to tell us whether we are in a decorator internal and should stop.
820 Utility to tell us whether we are in a decorator internal and should stop.
822
821
823
824
825 """
822 """
826
823
827 # if we are disabled don't skip
824 # if we are disabled don't skip
@@ -826,15 +826,19 b' class Image(DisplayObject):'
826 data : unicode, str or bytes
826 data : unicode, str or bytes
827 The raw image data or a URL or filename to load the data from.
827 The raw image data or a URL or filename to load the data from.
828 This always results in embedded image data.
828 This always results in embedded image data.
829
829 url : unicode
830 url : unicode
830 A URL to download the data from. If you specify `url=`,
831 A URL to download the data from. If you specify `url=`,
831 the image data will not be embedded unless you also specify `embed=True`.
832 the image data will not be embedded unless you also specify `embed=True`.
833
832 filename : unicode
834 filename : unicode
833 Path to a local file to load the data from.
835 Path to a local file to load the data from.
834 Images from a file are always embedded.
836 Images from a file are always embedded.
837
835 format : unicode
838 format : unicode
836 The format of the image data (png/jpeg/jpg/gif). If a filename or URL is given
839 The format of the image data (png/jpeg/jpg/gif). If a filename or URL is given
837 for format will be inferred from the filename extension.
840 for format will be inferred from the filename extension.
841
838 embed : bool
842 embed : bool
839 Should the image data be embedded using a data URI (True) or be
843 Should the image data be embedded using a data URI (True) or be
840 loaded using an <img> tag. Set this to True if you want the image
844 loaded using an <img> tag. Set this to True if you want the image
@@ -844,10 +848,13 b' class Image(DisplayObject):'
844 default value is `False`.
848 default value is `False`.
845
849
846 Note that QtConsole is not able to display images if `embed` is set to `False`
850 Note that QtConsole is not able to display images if `embed` is set to `False`
851
847 width : int
852 width : int
848 Width in pixels to which to constrain the image in html
853 Width in pixels to which to constrain the image in html
854
849 height : int
855 height : int
850 Height in pixels to which to constrain the image in html
856 Height in pixels to which to constrain the image in html
857
851 retina : bool
858 retina : bool
852 Automatically set the width and height to half of the measured
859 Automatically set the width and height to half of the measured
853 width and height.
860 width and height.
@@ -855,10 +862,13 b' class Image(DisplayObject):'
855 from image data.
862 from image data.
856 For non-embedded images, you can just set the desired display width
863 For non-embedded images, you can just set the desired display width
857 and height directly.
864 and height directly.
865
858 unconfined : bool
866 unconfined : bool
859 Set unconfined=True to disable max-width confinement of the image.
867 Set unconfined=True to disable max-width confinement of the image.
868
860 metadata : dict
869 metadata : dict
861 Specify extra metadata to attach to the image.
870 Specify extra metadata to attach to the image.
871
862 alt : unicode
872 alt : unicode
863 Alternative text for the image, for use by screen readers.
873 Alternative text for the image, for use by screen readers.
864
874
@@ -1067,12 +1077,15 b' class Video(DisplayObject):'
1067 data : unicode, str or bytes
1077 data : unicode, str or bytes
1068 The raw video data or a URL or filename to load the data from.
1078 The raw video data or a URL or filename to load the data from.
1069 Raw data will require passing ``embed=True``.
1079 Raw data will require passing ``embed=True``.
1080
1070 url : unicode
1081 url : unicode
1071 A URL for the video. If you specify ``url=``,
1082 A URL for the video. If you specify ``url=``,
1072 the image data will not be embedded.
1083 the image data will not be embedded.
1084
1073 filename : unicode
1085 filename : unicode
1074 Path to a local file containing the video.
1086 Path to a local file containing the video.
1075 Will be interpreted as a local URL unless ``embed=True``.
1087 Will be interpreted as a local URL unless ``embed=True``.
1088
1076 embed : bool
1089 embed : bool
1077 Should the video be embedded using a data URI (True) or be
1090 Should the video be embedded using a data URI (True) or be
1078 loaded using a <video> tag (False).
1091 loaded using a <video> tag (False).
@@ -1083,15 +1096,19 b' class Video(DisplayObject):'
1083 Local files can be displayed with URLs without embedding the content, via::
1096 Local files can be displayed with URLs without embedding the content, via::
1084
1097
1085 Video('./video.mp4')
1098 Video('./video.mp4')
1099
1086 mimetype : unicode
1100 mimetype : unicode
1087 Specify the mimetype for embedded videos.
1101 Specify the mimetype for embedded videos.
1088 Default will be guessed from file extension, if available.
1102 Default will be guessed from file extension, if available.
1103
1089 width : int
1104 width : int
1090 Width in pixels to which to constrain the video in HTML.
1105 Width in pixels to which to constrain the video in HTML.
1091 If not supplied, defaults to the width of the video.
1106 If not supplied, defaults to the width of the video.
1107
1092 height : int
1108 height : int
1093 Height in pixels to which to constrain the video in html.
1109 Height in pixels to which to constrain the video in html.
1094 If not supplied, defaults to the height of the video.
1110 If not supplied, defaults to the height of the video.
1111
1095 html_attributes : str
1112 html_attributes : str
1096 Attributes for the HTML ``<video>`` block.
1113 Attributes for the HTML ``<video>`` block.
1097 Default: ``"controls"`` to get video controls.
1114 Default: ``"controls"`` to get video controls.
@@ -1221,7 +1238,6 b' def set_matplotlib_close(close=True):'
1221
1238
1222 use `matplotlib_inline.backend_inline.set_matplotlib_close()`
1239 use `matplotlib_inline.backend_inline.set_matplotlib_close()`
1223
1240
1224
1225 Set whether the inline backend closes all figures automatically or not.
1241 Set whether the inline backend closes all figures automatically or not.
1226
1242
1227 By default, the inline backend used in the IPython Notebook will close all
1243 By default, the inline backend used in the IPython Notebook will close all
@@ -433,6 +433,7 b' class BaseFormatter(Configurable):'
433 ----------
433 ----------
434 typ : type or '__module__.__name__' string for a type
434 typ : type or '__module__.__name__' string for a type
435 The class of the object that will be formatted using `func`.
435 The class of the object that will be formatted using `func`.
436
436 func : callable
437 func : callable
437 A callable for computing the format data.
438 A callable for computing the format data.
438 `func` will be called with the object to be formatted,
439 `func` will be called with the object to be formatted,
@@ -474,8 +475,10 b' class BaseFormatter(Configurable):'
474 type_module : str
475 type_module : str
475 The full dotted name of the module the type is defined in, like
476 The full dotted name of the module the type is defined in, like
476 ``numpy``.
477 ``numpy``.
478
477 type_name : str
479 type_name : str
478 The name of the type (the class name), like ``dtype``
480 The name of the type (the class name), like ``dtype``
481
479 func : callable
482 func : callable
480 A callable for computing the format data.
483 A callable for computing the format data.
481 `func` will be called with the object to be formatted,
484 `func` will be called with the object to be formatted,
1 NO CONTENT: modified file
NO CONTENT: modified file
@@ -305,13 +305,11 b' class HistoryAccessor(HistoryAccessorBase):'
305
305
306 Parameters
306 Parameters
307 ----------
307 ----------
308
309 session : int
308 session : int
310 Session number to retrieve.
309 Session number to retrieve.
311
310
312 Returns
311 Returns
313 -------
312 -------
314
315 session_id : int
313 session_id : int
316 Session ID number
314 Session ID number
317 start : datetime
315 start : datetime
@@ -605,14 +603,12 b' class HistoryManager(HistoryAccessor):'
605
603
606 Parameters
604 Parameters
607 ----------
605 ----------
608
609 session : int
606 session : int
610 Session number to retrieve. The current session is 0, and negative
607 Session number to retrieve. The current session is 0, and negative
611 numbers count back from current session, so -1 is the previous session.
608 numbers count back from current session, so -1 is the previous session.
612
609
613 Returns
610 Returns
614 -------
611 -------
615
616 session_id : int
612 session_id : int
617 Session ID number
613 Session ID number
618 start : datetime
614 start : datetime
@@ -695,10 +691,8 b' class HistoryManager(HistoryAccessor):'
695 ----------
691 ----------
696 line_num : int
692 line_num : int
697 The prompt number of this input.
693 The prompt number of this input.
698
699 source : str
694 source : str
700 Python input.
695 Python input.
701
702 source_raw : str, optional
696 source_raw : str, optional
703 If given, this is the raw input without any IPython transformations
697 If given, this is the raw input without any IPython transformations
704 applied to it. If not given, ``source`` is used.
698 applied to it. If not given, ``source`` is used.
1 NO CONTENT: modified file
NO CONTENT: modified file
@@ -407,7 +407,6 b' def _strip_prompts(prompt_re, initial_re=None, turnoff_re=None):'
407 If no initial expression is given, prompt_re will be used everywhere.
407 If no initial expression is given, prompt_re will be used everywhere.
408 Used mainly for plain Python prompts, where the continuation prompt
408 Used mainly for plain Python prompts, where the continuation prompt
409 ``...`` is a valid Python expression in Python 3, so shouldn't be stripped.
409 ``...`` is a valid Python expression in Python 3, so shouldn't be stripped.
410
411 If initial_re and prompt_re differ,
410 If initial_re and prompt_re differ,
412 only initial_re will be tested against the first line.
411 only initial_re will be tested against the first line.
413 If any prompt is found on the first two lines,
412 If any prompt is found on the first two lines,
@@ -640,7 +640,7 b' class TransformerManager:'
640
640
641 Parameters
641 Parameters
642 ----------
642 ----------
643 source : string
643 cell : string
644 Python input code, which can be multiline.
644 Python input code, which can be multiline.
645
645
646 Returns
646 Returns
@@ -1730,7 +1730,6 b' class InteractiveShell(SingletonConfigurable):'
1730
1730
1731 Parameters
1731 Parameters
1732 ----------
1732 ----------
1733
1734 exc_tuple : tuple of exception classes
1733 exc_tuple : tuple of exception classes
1735 A *tuple* of exception classes, for which to call the defined
1734 A *tuple* of exception classes, for which to call the defined
1736 handler. It is very important that you use a tuple, and NOT A
1735 handler. It is very important that you use a tuple, and NOT A
@@ -1760,7 +1759,6 b' class InteractiveShell(SingletonConfigurable):'
1760
1759
1761 Notes
1760 Notes
1762 -----
1761 -----
1763
1764 WARNING: by putting in your own exception handler into IPython's main
1762 WARNING: by putting in your own exception handler into IPython's main
1765 execution loop, you run a very good chance of nasty crashes. This
1763 execution loop, you run a very good chance of nasty crashes. This
1766 facility should only be used if you really know what you are doing.
1764 facility should only be used if you really know what you are doing.
@@ -2056,15 +2054,12 b' class InteractiveShell(SingletonConfigurable):'
2056
2054
2057 Parameters
2055 Parameters
2058 ----------
2056 ----------
2059
2060 text : string
2057 text : string
2061 A string of text to be completed on. It can be given as empty and
2058 A string of text to be completed on. It can be given as empty and
2062 instead a line/position pair are given. In this case, the
2059 instead a line/position pair are given. In this case, the
2063 completer itself will split the line like readline does.
2060 completer itself will split the line like readline does.
2064
2065 line : string, optional
2061 line : string, optional
2066 The complete line that text is part of.
2062 The complete line that text is part of.
2067
2068 cursor_pos : int, optional
2063 cursor_pos : int, optional
2069 The position of the cursor on the input line.
2064 The position of the cursor on the input line.
2070
2065
@@ -2072,11 +2067,9 b' class InteractiveShell(SingletonConfigurable):'
2072 -------
2067 -------
2073 text : string
2068 text : string
2074 The actual text that was completed.
2069 The actual text that was completed.
2075
2076 matches : list
2070 matches : list
2077 A sorted list with all possible completions.
2071 A sorted list with all possible completions.
2078
2072
2079
2080 Notes
2073 Notes
2081 -----
2074 -----
2082 The optional arguments allow the completion to take more context into
2075 The optional arguments allow the completion to take more context into
@@ -2089,7 +2082,6 b' class InteractiveShell(SingletonConfigurable):'
2089
2082
2090 Examples
2083 Examples
2091 --------
2084 --------
2092
2093 In [1]: x = 'hello'
2085 In [1]: x = 'hello'
2094
2086
2095 In [2]: _ip.complete('x.l')
2087 In [2]: _ip.complete('x.l')
@@ -2606,7 +2598,7 b' class InteractiveShell(SingletonConfigurable):'
2606 ----------
2598 ----------
2607 fname : string
2599 fname : string
2608 The name of the file to be executed.
2600 The name of the file to be executed.
2609 where : tuple
2601 *where : tuple
2610 One or two namespaces, passed to execfile() as (globals,locals).
2602 One or two namespaces, passed to execfile() as (globals,locals).
2611 If only one is given, it is passed as both.
2603 If only one is given, it is passed as both.
2612 exit_ignore : bool (False)
2604 exit_ignore : bool (False)
@@ -2843,7 +2835,6 b' class InteractiveShell(SingletonConfigurable):'
2843 -------
2835 -------
2844 result: bool
2836 result: bool
2845 Whether the code needs to be run with a coroutine runner or not
2837 Whether the code needs to be run with a coroutine runner or not
2846
2847 .. versionadded:: 7.0
2838 .. versionadded:: 7.0
2848 """
2839 """
2849 if not self.autoawait:
2840 if not self.autoawait:
@@ -3290,7 +3281,7 b' class InteractiveShell(SingletonConfigurable):'
3290
3281
3291 Parameters
3282 Parameters
3292 ----------
3283 ----------
3293 source : string
3284 code : string
3294 Python input code, which can be multiline.
3285 Python input code, which can be multiline.
3295
3286
3296 Returns
3287 Returns
@@ -3491,7 +3482,6 b' class InteractiveShell(SingletonConfigurable):'
3491
3482
3492 Notes
3483 Notes
3493 -----
3484 -----
3494
3495 Slices can be described with two notations:
3485 Slices can be described with two notations:
3496
3486
3497 * ``N:M`` -> standard python form, means including items N...(M-1).
3487 * ``N:M`` -> standard python form, means including items N...(M-1).
@@ -3536,7 +3526,6 b' class InteractiveShell(SingletonConfigurable):'
3536 Returns
3526 Returns
3537 -------
3527 -------
3538 A string of code.
3528 A string of code.
3539
3540 ValueError is raised if nothing is found, and TypeError if it evaluates
3529 ValueError is raised if nothing is found, and TypeError if it evaluates
3541 to an object of another type. In each case, .args[0] is a printable
3530 to an object of another type. In each case, .args[0] is a printable
3542 message.
3531 message.
@@ -115,13 +115,10 b' def record_magic(dct, magic_kind, magic_name, func):'
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 """
@@ -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
@@ -423,10 +420,8 b' class MagicsManager(Configurable):'
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.
@@ -451,10 +446,8 b' class MagicsManager(Configurable):'
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 """
@@ -580,21 +573,16 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
@@ -623,7 +623,6 b' class AsyncMagics(BasicMagics):'
623 If the object is a fully qualified object name, attempt to import it and
623 If the object is a fully qualified object name, attempt to import it and
624 set it as the runner, and activate autoawait.
624 set it as the runner, and activate autoawait.
625
625
626
627 The exact behavior of autoawait is experimental and subject to change
626 The exact behavior of autoawait is experimental and subject to change
628 across version of IPython and Python.
627 across version of IPython and Python.
629 """
628 """
@@ -1067,7 +1067,6 b' class ExecutionMagics(Magics):'
1067
1067
1068 In [6]: %timeit -n1 time.sleep(2)
1068 In [6]: %timeit -n1 time.sleep(2)
1069
1069
1070
1071 The times reported by %timeit will be slightly higher than those
1070 The times reported by %timeit will be slightly higher than those
1072 reported by the timeit.py script when variables are accessed. This is
1071 reported by the timeit.py script when variables are accessed. This is
1073 due to the fact that %timeit executes the statement in the namespace
1072 due to the fact that %timeit executes the statement in the namespace
@@ -1238,7 +1237,6 b' class ExecutionMagics(Magics):'
1238 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1237 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1239 Wall time: 0.00
1238 Wall time: 0.00
1240
1239
1241
1242 .. note::
1240 .. note::
1243 The time needed by Python to compile the given expression will be
1241 The time needed by Python to compile the given expression will be
1244 reported if it is more than 0.1s.
1242 reported if it is more than 0.1s.
1 NO CONTENT: modified file
NO CONTENT: modified file
1 NO CONTENT: modified file
NO CONTENT: modified file
@@ -252,7 +252,6 b' class NamespaceMagics(Magics):'
252
252
253 Examples
253 Examples
254 --------
254 --------
255
256 Define two variables and list them with who_ls::
255 Define two variables and list them with who_ls::
257
256
258 In [1]: alpha = 123
257 In [1]: alpha = 123
@@ -367,7 +366,6 b' class NamespaceMagics(Magics):'
367
366
368 Examples
367 Examples
369 --------
368 --------
370
371 Define two variables and list them with whos::
369 Define two variables and list them with whos::
372
370
373 In [1]: alpha = 123
371 In [1]: alpha = 123
@@ -484,23 +482,21 b' class NamespaceMagics(Magics):'
484
482
485 Parameters
483 Parameters
486 ----------
484 ----------
487 -f : force reset without asking for confirmation.
485 -f
488
486 force reset without asking for confirmation.
489 -s : 'Soft' reset: Only clears your namespace, leaving history intact.
487 -s
488 'Soft' reset: Only clears your namespace, leaving history intact.
490 References to objects may be kept. By default (without this option),
489 References to objects may be kept. By default (without this option),
491 we do a 'hard' reset, giving you a new session and removing all
490 we do a 'hard' reset, giving you a new session and removing all
492 references to objects from the current session.
491 references to objects from the current session.
493
492 --aggressive
494 --aggressive: Try to aggressively remove modules from sys.modules ; this
493 Try to aggressively remove modules from sys.modules ; this
495 may allow you to reimport Python modules that have been updated and
494 may allow you to reimport Python modules that have been updated and
496 pick up changes, but can have unattended consequences.
495 pick up changes, but can have unattended consequences.
497
496
498 in : reset input history
497 in : reset input history
499
500 out : reset output history
498 out : reset output history
501
502 dhist : reset directory history
499 dhist : reset directory history
503
504 array : reset only variables that are NumPy arrays
500 array : reset only variables that are NumPy arrays
505
501
506 See Also
502 See Also
@@ -624,7 +620,6 b' class NamespaceMagics(Magics):'
624
620
625 Examples
621 Examples
626 --------
622 --------
627
628 We first fully reset the namespace so your output looks identical to
623 We first fully reset the namespace so your output looks identical to
629 this example for pedagogical reasons; in practice you do not need a
624 this example for pedagogical reasons; in practice you do not need a
630 full reset::
625 full reset::
@@ -316,7 +316,6 b' class OSMagics(Magics):'
316 ``cd <bookmark_name>`` is enough if there is no directory
316 ``cd <bookmark_name>`` is enough if there is no directory
317 ``<bookmark_name>``, but a bookmark with the name exists.
317 ``<bookmark_name>``, but a bookmark with the name exists.
318
318
319
320 Options:
319 Options:
321
320
322 -q Be quiet. Do not print the working directory after the
321 -q Be quiet. Do not print the working directory after the
@@ -329,7 +328,6 b' class OSMagics(Magics):'
329 where ``!command`` runs is immediately discarded after executing
328 where ``!command`` runs is immediately discarded after executing
330 'command'.
329 'command'.
331
330
332
333 Examples
331 Examples
334 --------
332 --------
335 ::
333 ::
1 NO CONTENT: modified file
NO CONTENT: modified file
@@ -428,7 +428,6 b' class Inspector(Colorable):'
428
428
429 Examples
429 Examples
430 --------
430 --------
431
432 In [1]: class NoInit:
431 In [1]: class NoInit:
433 ...: pass
432 ...: pass
434
433
@@ -575,8 +574,7 b' class Inspector(Colorable):'
575 """Retrieve an info dict and format it.
574 """Retrieve an info dict and format it.
576
575
577 Parameters
576 Parameters
578 ==========
577 ----------
579
580 obj: any
578 obj : any
581 Object to inspect and return info from
579 Object to inspect and return info from
582 oname: str (default: ''):
580 oname: str (default: ''):
@@ -716,11 +714,10 b' class Inspector(Colorable):'
716 """Compute a dict with detailed information about an object.
714 """Compute a dict with detailed information about an object.
717
715
718 Parameters
716 Parameters
719 ==========
717 ----------
720
721 obj: any
718 obj : any
722 An object to find information about
719 An object to find information about
723 oname: str (default: ''):
720 oname : str (default: '')
724 Name of the variable pointing to `obj`.
721 Name of the variable pointing to `obj`.
725 info: (default: None)
722 info : (default: None)
726 A struct (dict like with attr access) with some information fields
723 A struct (dict like with attr access) with some information fields
@@ -729,8 +726,7 b' class Inspector(Colorable):'
729 If set to 1, more information is given.
726 If set to 1, more information is given.
730
727
731 Returns
728 Returns
732 =======
729 -------
733
734 An object info dict with known fields from `info_fields`. Keys are
730 An object info dict with known fields from `info_fields`. Keys are
735 strings, values are string or None.
731 strings, values are string or None.
736 """
732 """
1 NO CONTENT: modified file
NO CONTENT: modified file
@@ -18,7 +18,6 b' def page(strng, start=0, screen_lines=0, pager_cmd=None):'
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 """
@@ -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
@@ -195,7 +195,6 b' def import_pyqt4(version=2):'
195 version : 1, 2, or None
195 version : 1, 2, or None
196 Which QString/QVariant API to use. Set to None to use the system
196 Which QString/QVariant API to use. Set to None to use the system
197 default
197 default
198
199 ImportErrors raised within this function are non-recoverable
198 ImportErrors raised within this function are non-recoverable
200 """
199 """
201 # The new-style string API (version=2) automatically
200 # The new-style string API (version=2) automatically
@@ -325,7 +324,6 b' def load_qt(api_options):'
325
324
326 Returns
325 Returns
327 -------
326 -------
328
329 A tuple of QtCore, QtGui, QtSvg, QT_API
327 A tuple of QtCore, QtGui, QtSvg, QT_API
330 The first three are the Qt modules. The last is the
328 The first three are the Qt modules. The last is the
331 string indicating which module was loaded.
329 string indicating which module was loaded.
1 NO CONTENT: modified file
NO CONTENT: modified file
1 NO CONTENT: modified file
NO CONTENT: modified file
1 NO CONTENT: modified file
NO CONTENT: modified file
@@ -77,7 +77,6 b" def latex_to_png(s, encode=False, backend=None, wrap=False, color='Black',"
77 format, e.g. '#AA20FA'.
77 format, e.g. '#AA20FA'.
78 scale : float
78 scale : float
79 Scale factor for the resulting PNG.
79 Scale factor for the resulting PNG.
80
81 None is returned when the backend cannot be used.
80 None is returned when the backend cannot be used.
82
81
83 """
82 """
@@ -49,7 +49,6 b' class EmbeddedMagics(Magics):'
49 you may then kill it and the program will then continue to run without
49 you may then kill it and the program will then continue to run without
50 the interactive shell interfering again.
50 the interactive shell interfering again.
51
51
52
53 Kill Instance Option:
52 Kill Instance Option:
54
53
55 If for some reasons you need to kill the location where the instance
54 If for some reasons you need to kill the location where the instance
@@ -266,20 +265,16 b' class InteractiveShellEmbed(TerminalInteractiveShell):'
266
265
267 Parameters
266 Parameters
268 ----------
267 ----------
269
270
271 local_ns, module
268 local_ns, module
272 Working local namespace (a dict) and module (a module or similar
269 Working local namespace (a dict) and module (a module or similar
273 object). If given as None, they are automatically taken from the scope
270 object). If given as None, they are automatically taken from the scope
274 where the shell was called, so that program variables become visible.
271 where the shell was called, so that program variables become visible.
275
276 stack_depth : int
272 stack_depth : int
277 How many levels in the stack to go to looking for namespaces (when
273 How many levels in the stack to go to looking for namespaces (when
278 local_ns or module is None). This allows an intermediate caller to
274 local_ns or module is None). This allows an intermediate caller to
279 make sure that this function gets the namespace from the intended
275 make sure that this function gets the namespace from the intended
280 level in the stack. By default (0) it will get its locals and globals
276 level in the stack. By default (0) it will get its locals and globals
281 from the immediate caller.
277 from the immediate caller.
282
283 compile_flags
278 compile_flags
284 A bit field identifying the __future__ features
279 A bit field identifying the __future__ features
285 that are enabled, as passed to the builtin :func:`compile` function.
280 that are enabled, as passed to the builtin :func:`compile` function.
@@ -113,7 +113,7 b' class TerminalMagics(Magics):'
113
113
114 Shell escapes are not supported (yet).
114 Shell escapes are not supported (yet).
115
115
116 See also
116 See Also
117 --------
117 --------
118 paste: automatically pull code from clipboard.
118 paste : automatically pull code from clipboard.
119
119
@@ -176,7 +176,7 b' class TerminalMagics(Magics):'
176
176
177 IPython statements (magics, shell escapes) are not supported (yet).
177 IPython statements (magics, shell escapes) are not supported (yet).
178
178
179 See also
179 See Also
180 --------
180 --------
181 cpaste: manually paste code into terminal until you mark its end.
181 cpaste : manually paste code into terminal until you mark its end.
182 """
182 """
@@ -22,12 +22,24 b' Need to be updated:'
22
22
23 pr/*
23 pr/*
24
24
25 IPython 8.0 is bringing a number of new features and improvements to both the
25 IPython 8.0 is bringing a large number of new features and improvements to both the
26 user of the terminal and of the kernel via Jupyter. The removal of compatibility
26 user of the terminal and of the kernel via Jupyter. The removal of compatibility
27 with older version of Python is also the opportunity to do a couple of
27 with older version of Python is also the opportunity to do a couple of
28 performance improvement in particular with respect to startup time.
28 performance improvement in particular with respect to startup time.
29
29
30 The main change in IPython 8.0 is the integration of the ``stack_data`` package;
30 This release contains 250+ Pull requests, in addition to many of the features
31 and backports that have made it to the 7.x branch.
32
33 We removed almost all features, arguments, functions, and modules that were
34 marked as deprecated between IPython 1.0 and 5.0 and before. As reminder 5.0 was
35 released in 2016, and 1.0 in 2013. Last release of the 5 branch was 5.10.0, in
36 may 2020. The few remaining deprecated features have better deprecation warnings
37 or errors.
38
39 There are many change in IPython 8.0 will will try to describe subsequently,
40
41
42 The first on is the integration of the ``stack_data`` package;
31 which provide smarter information in traceback; in particular it will highlight
43 which provide smarter information in traceback; in particular it will highlight
32 the AST node where an error occurs which can help to quickly narrow down errors.
44 the AST node where an error occurs which can help to quickly narrow down errors.
33
45
@@ -50,13 +62,34 b' IPython 8.0 is capable of telling you, where the index error occurs::'
50 return x[0][i][0]
62 return x[0][i][0]
51 ^
63 ^
52
64
65
66 Numfocus Small Developer Grant
67 ------------------------------
68
53 To prepare for Python 3.10 we have also started working on removing reliance and
69 To prepare for Python 3.10 we have also started working on removing reliance and
54 any dependency that is not Python 3.10 compatible; that include migrating our
70 any dependency that is not Python 3.10 compatible; that include migrating our
55 test suite to Pytest, and starting to remove nose.
71 test suite to pytest, and starting to remove nose. This also mean that the
72 ``iptest`` command is now gone, and all testing is via pytest.
73
74 This was in bog part thanks the NumFOCUS Small Developer grant, we were able to
75 allocate 4000 to hire `Nikita Kniazev @Kojoley <https://github.com/Kojoley>`__
76 who did a fantastic job at updating our code base, migrating to pytest, pushing
77 our coverage, and fixing a large number of bugs. I highly recommend contacting
78 them if you need help with C++ and Python projects
56
79
57 We are also removing support for Python 3.6 allowing internal code to use more
80 You can find all relevant issues and PRs with the SDG 2021 tag:
81
82 https://github.com/ipython/ipython/issues?q=label%3A%22Numfocus+SDG+2021%22+
83
84 Removing support for Older Python
85 ---------------------------------
86
87
88 We are also removing support for Python up to 3.7 allowing internal code to use more
58 efficient ``pathlib``, and make better use of type annotations.
89 efficient ``pathlib``, and make better use of type annotations.
59
90
91 IMAGE : Pathlib, pathlib everywhere.
92
60 The completer has also seen significant updates and make use of newer Jedi API
93 The completer has also seen significant updates and make use of newer Jedi API
61 offering faster and more reliable tab completion.
94 offering faster and more reliable tab completion.
62
95
@@ -168,7 +201,154 b' Try ``%autoreload 3`` in an IPython session after running ``%load_ext autoreload'
168 For more information please see unit test -
201 For more information please see unit test -
169 extensions/tests/test_autoreload.py : 'test_autoload_newly_added_objects'
202 extensions/tests/test_autoreload.py : 'test_autoload_newly_added_objects'
170
203
171 =======
204
205 Miscelanious
206 ------------
207
208 Minimum supported
209
210
211 History Range Glob feature
212 ==========================
213
214 Previously, when using ``%history``, users could specify either
215 a range of sessions and lines, for example:
216
217 .. code-block:: python
218
219 ~8/1-~6/5 # see history from the first line of 8 sessions ago,
220 # to the fifth line of 6 sessions ago.``
221
222 Or users could specify a glob pattern:
223
224 .. code-block:: python
225
226 -g <pattern> # glob ALL history for the specified pattern.
227
228 However users could *not* specify both.
229
230 If a user *did* specify both a range and a glob pattern,
231 then the glob pattern would be used (globbing *all* history) *and the range would be ignored*.
232
233 ---
234
235 With this enhancement, if a user specifies both a range and a glob pattern, then the glob pattern will be applied to the specified range of history.
236
237 Don't start a multi line cell with sunken parenthesis
238 -----------------------------------------------------
239
240 From now on IPython will not ask for the next line of input when given a single
241 line with more closing than opening brackets. For example, this means that if
242 you (mis)type ']]' instead of '[]', a ``SyntaxError`` will show up, instead of
243 the ``...:`` prompt continuation.
244
245 IPython shell for ipdb interact
246 -------------------------------
247
248 The ipdb ``interact`` starts an IPython shell instead of Python's built-in ``code.interact()``.
249
250 Automatic Vi prompt stripping
251 =============================
252
253 When pasting code into IPython, it will strip the leading prompt characters if
254 there are any. For example, you can paste the following code into the console -
255 it will still work, even though each line is prefixed with prompts (`In`,
256 `Out`)::
257
258 In [1]: 2 * 2 == 4
259 Out[1]: True
260
261 In [2]: print("This still works as pasted")
262
263
264 Previously, this was not the case for the Vi-mode prompts::
265
266 In [1]: [ins] In [13]: 2 * 2 == 4
267 ...: Out[13]: True
268 ...:
269 File "<ipython-input-1-727bb88eaf33>", line 1
270 [ins] In [13]: 2 * 2 == 4
271 ^
272 SyntaxError: invalid syntax
273
274 This is now fixed, and Vi prompt prefixes - ``[ins]`` and ``[nav]`` - are
275 skipped just as the normal ``In`` would be.
276
277 IPython shell can be started in the Vi mode using ``ipython
278 --TerminalInteractiveShell.editing_mode=vi``
279
280 Empty History Ranges
281 ====================
282
283 A number of magics that take history ranges can now be used with an empty
284 range. These magics are:
285
286 * ``%save``
287 * ``%load``
288 * ``%pastebin``
289 * ``%pycat``
290
291 Using them this way will make them take the history of the current session up
292 to the point of the magic call (such that the magic itself will not be
293 included).
294
295 Therefore it is now possible to save the whole history to a file using simple
296 ``%save <filename>``, load and edit it using ``%load`` (makes for a nice usage
297 when followed with :kbd:`F2`), send it to dpaste.org using ``%pastebin``, or
298 view the whole thing syntax-highlighted with a single ``%pycat``.
299
300 Traceback improvements
301 ======================
302
303
304 UPDATE THIS IN INPUT.
305
306 Previously, error tracebacks for errors happening in code cells were showing a hash, the one used for compiling the Python AST::
307
308 In [1]: def foo():
309 ...: return 3 / 0
310 ...:
311
312 In [2]: foo()
313 ---------------------------------------------------------------------------
314 ZeroDivisionError Traceback (most recent call last)
315 <ipython-input-2-c19b6d9633cf> in <module>
316 ----> 1 foo()
317
318 <ipython-input-1-1595a74c32d5> in foo()
319 1 def foo():
320 ----> 2 return 3 / 0
321 3
322
323 ZeroDivisionError: division by zero
324
325 The error traceback is now correctly formatted, showing the cell number in which the error happened::
326
327 In [1]: def foo():
328 ...: return 3 / 0
329 ...:
330
331 In [2]: foo()
332 ---------------------------------------------------------------------------
333 ZeroDivisionError Traceback (most recent call last)
334 In [2], in <module>
335 ----> 1 foo()
336
337 In [1], in foo()
338 1 def foo():
339 ----> 2 return 3 / 0
340
341 ZeroDivisionError: division by zero
342
343 Remove Deprecated Stuff
344 =======================
345
346
347 We no longer need to add `extensions` to the PYTHONPATH because that is being
348 handled by `load_extension`.
349
350 We are also removing Cythonmagic, sympyprinting and rmagic as they are now in
351 other packages and no longer need to be inside IPython.
172
352
173 .. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT.
353 .. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT.
174
354
@@ -101,7 +101,7 b' pygments.lexers ='
101
101
102 [velin]
102 [velin]
103 ignore_patterns =
103 ignore_patterns =
104 IPython/core/tests,
104 IPython/core/tests
105 IPython/testing
105 IPython/testing
106
106
107 [tool.black]
107 [tool.black]
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now