Show More
@@ -462,7 +462,7 b' def _deduplicate_completions(text: str, completions: _IC)-> _IC:' | |||
|
462 | 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 | 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 | 479 | text that should be completed. |
|
480 | 480 | completions : Iterator[Completion] |
|
481 | 481 | iterator over the completions to rectify |
|
482 | _debug : bool | |
|
483 | Log failed completion | |
|
482 | 484 | |
|
483 | 485 | Notes |
|
484 | 486 | ----- |
@@ -1128,16 +1130,22 b' class IPCompleter(Completer):' | |||
|
1128 | 1130 | secondary optional dict for completions, to |
|
1129 | 1131 | handle cases (such as IPython embedded inside functions) where |
|
1130 | 1132 | both Python scopes are visible. |
|
1131 | use_readline : bool, optional | |
|
1132 | DEPRECATED, ignored since IPython 6.0, will have no effects | |
|
1133 | config : Config | |
|
1134 | traitlet's config object | |
|
1135 | **kwargs | |
|
1136 | passed to super class unmodified. | |
|
1133 | 1137 | """ |
|
1134 | 1138 | |
|
1135 | 1139 | self.magic_escape = ESC_MAGIC |
|
1136 | 1140 | self.splitter = CompletionSplitter() |
|
1137 | 1141 | |
|
1138 | 1142 | # _greedy_changed() depends on splitter and readline being defined: |
|
1139 | Completer.__init__(self, namespace=namespace, global_namespace=global_namespace, | |
|
1140 | config=config, **kwargs) | |
|
1143 | super().__init__( | |
|
1144 | namespace=namespace, | |
|
1145 | global_namespace=global_namespace, | |
|
1146 | config=config, | |
|
1147 | **kwargs | |
|
1148 | ) | |
|
1141 | 1149 | |
|
1142 | 1150 | # List where completion matches will be stored |
|
1143 | 1151 | self.matches = [] |
@@ -2055,9 +2063,9 b' class IPCompleter(Completer):' | |||
|
2055 | 2063 | |
|
2056 | 2064 | Parameters |
|
2057 | 2065 | ---------- |
|
2058 |
cursor_line |
|
|
2066 | cursor_line | |
|
2059 | 2067 | Index of the line the cursor is on. 0 indexed. |
|
2060 |
cursor_pos |
|
|
2068 | cursor_pos | |
|
2061 | 2069 | Position of the cursor in the current line/line_buffer/text. 0 |
|
2062 | 2070 | indexed. |
|
2063 | 2071 | line_buffer : optional, str |
@@ -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 |
@@ -798,7 +798,6 b' class Pdb(OldPdb):' | |||
|
798 | 798 | |
|
799 | 799 | def break_anywhere(self, frame): |
|
800 | 800 | """ |
|
801 | ||
|
802 | 801 | _stop_in_decorator_internals is overly restrictive, as we may still want |
|
803 | 802 | to trace function calls, so we need to also update break_anywhere so |
|
804 | 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 | 820 | Utility to tell us whether we are in a decorator internal and should stop. |
|
822 | 821 | |
|
823 | ||
|
824 | ||
|
825 | 822 | """ |
|
826 | 823 | |
|
827 | 824 | # if we are disabled don't skip |
@@ -826,15 +826,19 b' class Image(DisplayObject):' | |||
|
826 | 826 | data : unicode, str or bytes |
|
827 | 827 | The raw image data or a URL or filename to load the data from. |
|
828 | 828 | This always results in embedded image data. |
|
829 | ||
|
829 | 830 | url : unicode |
|
830 | 831 | A URL to download the data from. If you specify `url=`, |
|
831 | 832 | the image data will not be embedded unless you also specify `embed=True`. |
|
833 | ||
|
832 | 834 | filename : unicode |
|
833 | 835 | Path to a local file to load the data from. |
|
834 | 836 | Images from a file are always embedded. |
|
837 | ||
|
835 | 838 | format : unicode |
|
836 | 839 | The format of the image data (png/jpeg/jpg/gif). If a filename or URL is given |
|
837 | 840 | for format will be inferred from the filename extension. |
|
841 | ||
|
838 | 842 | embed : bool |
|
839 | 843 | Should the image data be embedded using a data URI (True) or be |
|
840 | 844 | loaded using an <img> tag. Set this to True if you want the image |
@@ -844,10 +848,13 b' class Image(DisplayObject):' | |||
|
844 | 848 | default value is `False`. |
|
845 | 849 | |
|
846 | 850 | Note that QtConsole is not able to display images if `embed` is set to `False` |
|
851 | ||
|
847 | 852 | width : int |
|
848 | 853 | Width in pixels to which to constrain the image in html |
|
854 | ||
|
849 | 855 | height : int |
|
850 | 856 | Height in pixels to which to constrain the image in html |
|
857 | ||
|
851 | 858 | retina : bool |
|
852 | 859 | Automatically set the width and height to half of the measured |
|
853 | 860 | width and height. |
@@ -855,10 +862,13 b' class Image(DisplayObject):' | |||
|
855 | 862 | from image data. |
|
856 | 863 | For non-embedded images, you can just set the desired display width |
|
857 | 864 | and height directly. |
|
865 | ||
|
858 | 866 | unconfined : bool |
|
859 | 867 | Set unconfined=True to disable max-width confinement of the image. |
|
868 | ||
|
860 | 869 | metadata : dict |
|
861 | 870 | Specify extra metadata to attach to the image. |
|
871 | ||
|
862 | 872 | alt : unicode |
|
863 | 873 | Alternative text for the image, for use by screen readers. |
|
864 | 874 | |
@@ -1067,12 +1077,15 b' class Video(DisplayObject):' | |||
|
1067 | 1077 | data : unicode, str or bytes |
|
1068 | 1078 | The raw video data or a URL or filename to load the data from. |
|
1069 | 1079 | Raw data will require passing ``embed=True``. |
|
1080 | ||
|
1070 | 1081 | url : unicode |
|
1071 | 1082 | A URL for the video. If you specify ``url=``, |
|
1072 | 1083 | the image data will not be embedded. |
|
1084 | ||
|
1073 | 1085 | filename : unicode |
|
1074 | 1086 | Path to a local file containing the video. |
|
1075 | 1087 | Will be interpreted as a local URL unless ``embed=True``. |
|
1088 | ||
|
1076 | 1089 | embed : bool |
|
1077 | 1090 | Should the video be embedded using a data URI (True) or be |
|
1078 | 1091 | loaded using a <video> tag (False). |
@@ -1083,15 +1096,19 b' class Video(DisplayObject):' | |||
|
1083 | 1096 | Local files can be displayed with URLs without embedding the content, via:: |
|
1084 | 1097 | |
|
1085 | 1098 | Video('./video.mp4') |
|
1099 | ||
|
1086 | 1100 | mimetype : unicode |
|
1087 | 1101 | Specify the mimetype for embedded videos. |
|
1088 | 1102 | Default will be guessed from file extension, if available. |
|
1103 | ||
|
1089 | 1104 | width : int |
|
1090 | 1105 | Width in pixels to which to constrain the video in HTML. |
|
1091 | 1106 | If not supplied, defaults to the width of the video. |
|
1107 | ||
|
1092 | 1108 | height : int |
|
1093 | 1109 | Height in pixels to which to constrain the video in html. |
|
1094 | 1110 | If not supplied, defaults to the height of the video. |
|
1111 | ||
|
1095 | 1112 | html_attributes : str |
|
1096 | 1113 | Attributes for the HTML ``<video>`` block. |
|
1097 | 1114 | Default: ``"controls"`` to get video controls. |
@@ -1221,7 +1238,6 b' def set_matplotlib_close(close=True):' | |||
|
1221 | 1238 | |
|
1222 | 1239 | use `matplotlib_inline.backend_inline.set_matplotlib_close()` |
|
1223 | 1240 | |
|
1224 | ||
|
1225 | 1241 | Set whether the inline backend closes all figures automatically or not. |
|
1226 | 1242 | |
|
1227 | 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 | 434 | typ : type or '__module__.__name__' string for a type |
|
435 | 435 | The class of the object that will be formatted using `func`. |
|
436 | ||
|
436 | 437 | func : callable |
|
437 | 438 | A callable for computing the format data. |
|
438 | 439 | `func` will be called with the object to be formatted, |
@@ -474,8 +475,10 b' class BaseFormatter(Configurable):' | |||
|
474 | 475 | type_module : str |
|
475 | 476 | The full dotted name of the module the type is defined in, like |
|
476 | 477 | ``numpy``. |
|
478 | ||
|
477 | 479 | type_name : str |
|
478 | 480 | The name of the type (the class name), like ``dtype`` |
|
481 | ||
|
479 | 482 | func : callable |
|
480 | 483 | A callable for computing the format data. |
|
481 | 484 | `func` will be called with the object to be formatted, |
|
1 | NO CONTENT: modified file |
@@ -305,13 +305,11 b' class HistoryAccessor(HistoryAccessorBase):' | |||
|
305 | 305 | |
|
306 | 306 | Parameters |
|
307 | 307 | ---------- |
|
308 | ||
|
309 | 308 | session : int |
|
310 | 309 | Session number to retrieve. |
|
311 | 310 | |
|
312 | 311 | Returns |
|
313 | 312 | ------- |
|
314 | ||
|
315 | 313 | session_id : int |
|
316 | 314 | Session ID number |
|
317 | 315 | start : datetime |
@@ -605,14 +603,12 b' class HistoryManager(HistoryAccessor):' | |||
|
605 | 603 | |
|
606 | 604 | Parameters |
|
607 | 605 | ---------- |
|
608 | ||
|
609 | 606 | session : int |
|
610 | 607 | Session number to retrieve. The current session is 0, and negative |
|
611 | 608 | numbers count back from current session, so -1 is the previous session. |
|
612 | 609 | |
|
613 | 610 | Returns |
|
614 | 611 | ------- |
|
615 | ||
|
616 | 612 | session_id : int |
|
617 | 613 | Session ID number |
|
618 | 614 | start : datetime |
@@ -695,10 +691,8 b' class HistoryManager(HistoryAccessor):' | |||
|
695 | 691 | ---------- |
|
696 | 692 | line_num : int |
|
697 | 693 | The prompt number of this input. |
|
698 | ||
|
699 | 694 | source : str |
|
700 | 695 | Python input. |
|
701 | ||
|
702 | 696 | source_raw : str, optional |
|
703 | 697 | If given, this is the raw input without any IPython transformations |
|
704 | 698 | applied to it. If not given, ``source`` is used. |
|
1 | NO CONTENT: modified file |
@@ -407,7 +407,6 b' def _strip_prompts(prompt_re, initial_re=None, turnoff_re=None):' | |||
|
407 | 407 | If no initial expression is given, prompt_re will be used everywhere. |
|
408 | 408 | Used mainly for plain Python prompts, where the continuation prompt |
|
409 | 409 | ``...`` is a valid Python expression in Python 3, so shouldn't be stripped. |
|
410 | ||
|
411 | 410 | If initial_re and prompt_re differ, |
|
412 | 411 | only initial_re will be tested against the first line. |
|
413 | 412 | If any prompt is found on the first two lines, |
@@ -640,7 +640,7 b' class TransformerManager:' | |||
|
640 | 640 | |
|
641 | 641 | Parameters |
|
642 | 642 | ---------- |
|
643 |
|
|
|
643 | cell : string | |
|
644 | 644 | Python input code, which can be multiline. |
|
645 | 645 | |
|
646 | 646 | Returns |
@@ -1730,7 +1730,6 b' class InteractiveShell(SingletonConfigurable):' | |||
|
1730 | 1730 | |
|
1731 | 1731 | Parameters |
|
1732 | 1732 | ---------- |
|
1733 | ||
|
1734 | 1733 | exc_tuple : tuple of exception classes |
|
1735 | 1734 | A *tuple* of exception classes, for which to call the defined |
|
1736 | 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 | 1760 | Notes |
|
1762 | 1761 | ----- |
|
1763 | ||
|
1764 | 1762 | WARNING: by putting in your own exception handler into IPython's main |
|
1765 | 1763 | execution loop, you run a very good chance of nasty crashes. This |
|
1766 | 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 | 2055 | Parameters |
|
2058 | 2056 | ---------- |
|
2059 | ||
|
2060 | 2057 |
|
|
2061 | 2058 |
|
|
2062 | 2059 |
|
|
2063 | 2060 |
|
|
2064 | ||
|
2065 | 2061 |
|
|
2066 | 2062 |
|
|
2067 | ||
|
2068 | 2063 |
|
|
2069 | 2064 |
|
|
2070 | 2065 | |
@@ -2072,11 +2067,9 b' class InteractiveShell(SingletonConfigurable):' | |||
|
2072 | 2067 | ------- |
|
2073 | 2068 | text : string |
|
2074 | 2069 | The actual text that was completed. |
|
2075 | ||
|
2076 | 2070 | matches : list |
|
2077 | 2071 | A sorted list with all possible completions. |
|
2078 | 2072 | |
|
2079 | ||
|
2080 | 2073 | Notes |
|
2081 | 2074 | ----- |
|
2082 | 2075 | The optional arguments allow the completion to take more context into |
@@ -2089,7 +2082,6 b' class InteractiveShell(SingletonConfigurable):' | |||
|
2089 | 2082 | |
|
2090 | 2083 | Examples |
|
2091 | 2084 | -------- |
|
2092 | ||
|
2093 | 2085 | In [1]: x = 'hello' |
|
2094 | 2086 | |
|
2095 | 2087 | In [2]: _ip.complete('x.l') |
@@ -2606,7 +2598,7 b' class InteractiveShell(SingletonConfigurable):' | |||
|
2606 | 2598 | ---------- |
|
2607 | 2599 | fname : string |
|
2608 | 2600 | The name of the file to be executed. |
|
2609 | where : tuple | |
|
2601 | *where : tuple | |
|
2610 | 2602 | One or two namespaces, passed to execfile() as (globals,locals). |
|
2611 | 2603 | If only one is given, it is passed as both. |
|
2612 | 2604 | exit_ignore : bool (False) |
@@ -2843,7 +2835,6 b' class InteractiveShell(SingletonConfigurable):' | |||
|
2843 | 2835 | ------- |
|
2844 | 2836 | result: bool |
|
2845 | 2837 | Whether the code needs to be run with a coroutine runner or not |
|
2846 | ||
|
2847 | 2838 | .. versionadded:: 7.0 |
|
2848 | 2839 | """ |
|
2849 | 2840 | if not self.autoawait: |
@@ -3290,7 +3281,7 b' class InteractiveShell(SingletonConfigurable):' | |||
|
3290 | 3281 | |
|
3291 | 3282 | Parameters |
|
3292 | 3283 | ---------- |
|
3293 |
|
|
|
3284 | code : string | |
|
3294 | 3285 | Python input code, which can be multiline. |
|
3295 | 3286 | |
|
3296 | 3287 | Returns |
@@ -3491,7 +3482,6 b' class InteractiveShell(SingletonConfigurable):' | |||
|
3491 | 3482 | |
|
3492 | 3483 | Notes |
|
3493 | 3484 | ----- |
|
3494 | ||
|
3495 | 3485 | Slices can be described with two notations: |
|
3496 | 3486 | |
|
3497 | 3487 | * ``N:M`` -> standard python form, means including items N...(M-1). |
@@ -3536,7 +3526,6 b' class InteractiveShell(SingletonConfigurable):' | |||
|
3536 | 3526 | Returns |
|
3537 | 3527 | ------- |
|
3538 | 3528 | A string of code. |
|
3539 | ||
|
3540 | 3529 | ValueError is raised if nothing is found, and TypeError if it evaluates |
|
3541 | 3530 | to an object of another type. In each case, .args[0] is a printable |
|
3542 | 3531 | message. |
@@ -115,13 +115,10 b' def record_magic(dct, magic_kind, magic_name, func):' | |||
|
115 | 115 | ---------- |
|
116 | 116 | dct : dict |
|
117 | 117 | A dictionary with 'line' and 'cell' subdicts. |
|
118 | ||
|
119 | 118 | magic_kind : str |
|
120 | 119 | Kind of magic to be stored. |
|
121 | ||
|
122 | 120 | magic_name : str |
|
123 | 121 | Key to store the magic as. |
|
124 | ||
|
125 | 122 | func : function |
|
126 | 123 | Callable object to store. |
|
127 | 124 | """ |
@@ -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 |
@@ -423,10 +420,8 b' class MagicsManager(Configurable):' | |||
|
423 | 420 | ---------- |
|
424 | 421 | func : callable |
|
425 | 422 | Function to be registered as a magic. |
|
426 | ||
|
427 | 423 | magic_kind : str |
|
428 | 424 | Kind of magic, one of 'line', 'cell' or 'line_cell' |
|
429 | ||
|
430 | 425 | magic_name : optional str |
|
431 | 426 | If given, the name the magic will have in the IPython namespace. By |
|
432 | 427 | default, the name of the function itself is used. |
@@ -451,10 +446,8 b' class MagicsManager(Configurable):' | |||
|
451 | 446 | ---------- |
|
452 | 447 | alias_name : str |
|
453 | 448 | The name of the magic to be registered. |
|
454 | ||
|
455 | 449 | magic_name : str |
|
456 | 450 | The name of an existing magic. |
|
457 | ||
|
458 | 451 | magic_kind : str |
|
459 | 452 | Kind of magic, one of 'line' or 'cell' |
|
460 | 453 | """ |
@@ -580,21 +573,16 b' class Magics(Configurable):' | |||
|
580 | 573 | |
|
581 | 574 | Parameters |
|
582 | 575 | ---------- |
|
583 | ||
|
584 | 576 | arg_str : str |
|
585 | 577 | The arguments to parse. |
|
586 | ||
|
587 | 578 | opt_str : str |
|
588 | 579 | The options specification. |
|
589 | ||
|
590 | 580 | mode : str, default 'string' |
|
591 | 581 | If given as 'list', the argument string is returned as a list (split |
|
592 | 582 | on whitespace) instead of a string. |
|
593 | ||
|
594 | 583 | list_all : bool, default False |
|
595 | 584 | Put all option values in lists. Normally only options |
|
596 | 585 | appearing more than once are put in a list. |
|
597 | ||
|
598 | 586 | posix : bool, default True |
|
599 | 587 | Whether to split the input line in POSIX mode or not, as per the |
|
600 | 588 | conventions outlined in the :mod:`shlex` module from the standard |
@@ -623,7 +623,6 b' class AsyncMagics(BasicMagics):' | |||
|
623 | 623 | If the object is a fully qualified object name, attempt to import it and |
|
624 | 624 | set it as the runner, and activate autoawait. |
|
625 | 625 | |
|
626 | ||
|
627 | 626 | The exact behavior of autoawait is experimental and subject to change |
|
628 | 627 | across version of IPython and Python. |
|
629 | 628 | """ |
@@ -1067,7 +1067,6 b' class ExecutionMagics(Magics):' | |||
|
1067 | 1067 | |
|
1068 | 1068 | In [6]: %timeit -n1 time.sleep(2) |
|
1069 | 1069 | |
|
1070 | ||
|
1071 | 1070 | The times reported by %timeit will be slightly higher than those |
|
1072 | 1071 | reported by the timeit.py script when variables are accessed. This is |
|
1073 | 1072 | due to the fact that %timeit executes the statement in the namespace |
@@ -1238,7 +1237,6 b' class ExecutionMagics(Magics):' | |||
|
1238 | 1237 | CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s |
|
1239 | 1238 | Wall time: 0.00 |
|
1240 | 1239 | |
|
1241 | ||
|
1242 | 1240 | .. note:: |
|
1243 | 1241 | The time needed by Python to compile the given expression will be |
|
1244 | 1242 | reported if it is more than 0.1s. |
|
1 | NO CONTENT: modified file |
|
1 | NO CONTENT: modified file |
@@ -252,7 +252,6 b' class NamespaceMagics(Magics):' | |||
|
252 | 252 | |
|
253 | 253 | Examples |
|
254 | 254 | -------- |
|
255 | ||
|
256 | 255 | Define two variables and list them with who_ls:: |
|
257 | 256 | |
|
258 | 257 | In [1]: alpha = 123 |
@@ -367,7 +366,6 b' class NamespaceMagics(Magics):' | |||
|
367 | 366 | |
|
368 | 367 | Examples |
|
369 | 368 | -------- |
|
370 | ||
|
371 | 369 | Define two variables and list them with whos:: |
|
372 | 370 | |
|
373 | 371 | In [1]: alpha = 123 |
@@ -484,23 +482,21 b' class NamespaceMagics(Magics):' | |||
|
484 | 482 | |
|
485 | 483 | Parameters |
|
486 | 484 | ---------- |
|
487 | -f : force reset without asking for confirmation. | |
|
488 | ||
|
489 | -s : 'Soft' reset: Only clears your namespace, leaving history intact. | |
|
485 | -f | |
|
486 | force reset without asking for confirmation. | |
|
487 | -s | |
|
488 | 'Soft' reset: Only clears your namespace, leaving history intact. | |
|
490 | 489 | References to objects may be kept. By default (without this option), |
|
491 | 490 | we do a 'hard' reset, giving you a new session and removing all |
|
492 | 491 | references to objects from the current session. |
|
493 | ||
|
494 |
|
|
|
492 | --aggressive | |
|
493 | Try to aggressively remove modules from sys.modules ; this | |
|
495 | 494 | may allow you to reimport Python modules that have been updated and |
|
496 | 495 | pick up changes, but can have unattended consequences. |
|
497 | 496 | |
|
498 | 497 | in : reset input history |
|
499 | ||
|
500 | 498 | out : reset output history |
|
501 | ||
|
502 | 499 | dhist : reset directory history |
|
503 | ||
|
504 | 500 | array : reset only variables that are NumPy arrays |
|
505 | 501 | |
|
506 | 502 | See Also |
@@ -624,7 +620,6 b' class NamespaceMagics(Magics):' | |||
|
624 | 620 | |
|
625 | 621 | Examples |
|
626 | 622 | -------- |
|
627 | ||
|
628 | 623 | We first fully reset the namespace so your output looks identical to |
|
629 | 624 | this example for pedagogical reasons; in practice you do not need a |
|
630 | 625 | full reset:: |
@@ -316,7 +316,6 b' class OSMagics(Magics):' | |||
|
316 | 316 | ``cd <bookmark_name>`` is enough if there is no directory |
|
317 | 317 | ``<bookmark_name>``, but a bookmark with the name exists. |
|
318 | 318 | |
|
319 | ||
|
320 | 319 | Options: |
|
321 | 320 | |
|
322 | 321 | -q Be quiet. Do not print the working directory after the |
@@ -329,7 +328,6 b' class OSMagics(Magics):' | |||
|
329 | 328 | where ``!command`` runs is immediately discarded after executing |
|
330 | 329 | 'command'. |
|
331 | 330 | |
|
332 | ||
|
333 | 331 | Examples |
|
334 | 332 | -------- |
|
335 | 333 | :: |
|
1 | NO CONTENT: modified file |
@@ -428,7 +428,6 b' class Inspector(Colorable):' | |||
|
428 | 428 | |
|
429 | 429 | Examples |
|
430 | 430 | -------- |
|
431 | ||
|
432 | 431 | In [1]: class NoInit: |
|
433 | 432 | ...: pass |
|
434 | 433 | |
@@ -575,8 +574,7 b' class Inspector(Colorable):' | |||
|
575 | 574 | """Retrieve an info dict and format it. |
|
576 | 575 | |
|
577 | 576 | Parameters |
|
578 | ========== | |
|
579 | ||
|
577 | ---------- | |
|
580 | 578 | obj: any |
|
581 | 579 | Object to inspect and return info from |
|
582 | 580 | oname: str (default: ''): |
@@ -716,11 +714,10 b' class Inspector(Colorable):' | |||
|
716 | 714 | """Compute a dict with detailed information about an object. |
|
717 | 715 | |
|
718 | 716 | Parameters |
|
719 | ========== | |
|
720 | ||
|
717 | ---------- | |
|
721 | 718 | obj: any |
|
722 | 719 | An object to find information about |
|
723 |
oname: str (default: '') |
|
|
720 | oname : str (default: '') | |
|
724 | 721 | Name of the variable pointing to `obj`. |
|
725 | 722 | info: (default: None) |
|
726 | 723 | A struct (dict like with attr access) with some information fields |
@@ -729,8 +726,7 b' class Inspector(Colorable):' | |||
|
729 | 726 | If set to 1, more information is given. |
|
730 | 727 | |
|
731 | 728 | Returns |
|
732 | ======= | |
|
733 | ||
|
729 | ------- | |
|
734 | 730 | An object info dict with known fields from `info_fields`. Keys are |
|
735 | 731 | strings, values are string or None. |
|
736 | 732 | """ |
|
1 | NO CONTENT: modified file |
@@ -18,7 +18,6 b' def page(strng, start=0, screen_lines=0, pager_cmd=None):' | |||
|
18 | 18 | ---------- |
|
19 | 19 | strng : str or mime-dict |
|
20 | 20 | Text to page, or a mime-type keyed dict of already formatted data. |
|
21 | ||
|
22 | 21 | start : int |
|
23 | 22 | Starting line at which to place the display. |
|
24 | 23 | """ |
@@ -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 |
|
|
|
559 | value : exception value | |
|
560 | 560 | """ |
|
561 | 561 | return ListTB.structured_traceback(self, etype, value) |
|
562 | 562 |
@@ -195,7 +195,6 b' def import_pyqt4(version=2):' | |||
|
195 | 195 | version : 1, 2, or None |
|
196 | 196 | Which QString/QVariant API to use. Set to None to use the system |
|
197 | 197 | default |
|
198 | ||
|
199 | 198 | ImportErrors raised within this function are non-recoverable |
|
200 | 199 | """ |
|
201 | 200 | # The new-style string API (version=2) automatically |
@@ -325,7 +324,6 b' def load_qt(api_options):' | |||
|
325 | 324 | |
|
326 | 325 | Returns |
|
327 | 326 | ------- |
|
328 | ||
|
329 | 327 | A tuple of QtCore, QtGui, QtSvg, QT_API |
|
330 | 328 | The first three are the Qt modules. The last is the |
|
331 | 329 | string indicating which module was loaded. |
|
1 | NO CONTENT: modified file |
|
1 | NO CONTENT: modified file |
|
1 | NO CONTENT: modified file |
@@ -77,7 +77,6 b" def latex_to_png(s, encode=False, backend=None, wrap=False, color='Black'," | |||
|
77 | 77 | format, e.g. '#AA20FA'. |
|
78 | 78 | scale : float |
|
79 | 79 | Scale factor for the resulting PNG. |
|
80 | ||
|
81 | 80 | None is returned when the backend cannot be used. |
|
82 | 81 | |
|
83 | 82 | """ |
@@ -49,7 +49,6 b' class EmbeddedMagics(Magics):' | |||
|
49 | 49 | you may then kill it and the program will then continue to run without |
|
50 | 50 | the interactive shell interfering again. |
|
51 | 51 | |
|
52 | ||
|
53 | 52 | Kill Instance Option: |
|
54 | 53 | |
|
55 | 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 | 266 | Parameters |
|
268 | 267 | ---------- |
|
269 | ||
|
270 | ||
|
271 | 268 | local_ns, module |
|
272 | 269 | Working local namespace (a dict) and module (a module or similar |
|
273 | 270 | object). If given as None, they are automatically taken from the scope |
|
274 | 271 | where the shell was called, so that program variables become visible. |
|
275 | ||
|
276 | 272 | stack_depth : int |
|
277 | 273 | How many levels in the stack to go to looking for namespaces (when |
|
278 | 274 | local_ns or module is None). This allows an intermediate caller to |
|
279 | 275 | make sure that this function gets the namespace from the intended |
|
280 | 276 | level in the stack. By default (0) it will get its locals and globals |
|
281 | 277 | from the immediate caller. |
|
282 | ||
|
283 | 278 | compile_flags |
|
284 | 279 | A bit field identifying the __future__ features |
|
285 | 280 | that are enabled, as passed to the builtin :func:`compile` function. |
@@ -113,7 +113,7 b' class TerminalMagics(Magics):' | |||
|
113 | 113 | |
|
114 | 114 | Shell escapes are not supported (yet). |
|
115 | 115 | |
|
116 |
See |
|
|
116 | See Also | |
|
117 | 117 | -------- |
|
118 | 118 | paste: automatically pull code from clipboard. |
|
119 | 119 | |
@@ -176,7 +176,7 b' class TerminalMagics(Magics):' | |||
|
176 | 176 | |
|
177 | 177 | IPython statements (magics, shell escapes) are not supported (yet). |
|
178 | 178 | |
|
179 |
See |
|
|
179 | See Also | |
|
180 | 180 | -------- |
|
181 | 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 | 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 | 26 | user of the terminal and of the kernel via Jupyter. The removal of compatibility |
|
27 | 27 | with older version of Python is also the opportunity to do a couple of |
|
28 | 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 | 43 | which provide smarter information in traceback; in particular it will highlight |
|
32 | 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 | 62 | return x[0][i][0] |
|
51 | 63 | ^ |
|
52 | 64 | |
|
65 | ||
|
66 | Numfocus Small Developer Grant | |
|
67 | ------------------------------ | |
|
68 | ||
|
53 | 69 | To prepare for Python 3.10 we have also started working on removing reliance and |
|
54 | 70 | any dependency that is not Python 3.10 compatible; that include migrating our |
|
55 |
test suite to |
|
|
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 | 89 | efficient ``pathlib``, and make better use of type annotations. |
|
59 | 90 | |
|
91 | IMAGE : Pathlib, pathlib everywhere. | |
|
92 | ||
|
60 | 93 | The completer has also seen significant updates and make use of newer Jedi API |
|
61 | 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 | 201 | For more information please see unit test - |
|
169 | 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 | 353 | .. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT. |
|
174 | 354 |
@@ -101,7 +101,7 b' pygments.lexers =' | |||
|
101 | 101 | |
|
102 | 102 | [velin] |
|
103 | 103 | ignore_patterns = |
|
104 |
IPython/core/tests |
|
|
104 | IPython/core/tests | |
|
105 | 105 | IPython/testing |
|
106 | 106 | |
|
107 | 107 | [tool.black] |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now