Browse Source

Intermediate changes
commit_hash:1f2ebe313aea1039145a9d68dcd511d5f22f383a

robot-piglet 2 months ago
parent
commit
dcbf444872

+ 48 - 48
contrib/python/ipython/py3/.dist-info/METADATA

@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: ipython
-Version: 8.29.0
+Version: 8.30.0
 Summary: IPython: Productive Interactive Computing
 Author: The IPython Development Team
 Author-email: ipython-dev@python.org
@@ -26,65 +26,65 @@ Classifier: Topic :: System :: Shells
 Requires-Python: >=3.10
 Description-Content-Type: text/x-rst
 License-File: LICENSE
+Requires-Dist: colorama; sys_platform == "win32"
 Requires-Dist: decorator
-Requires-Dist: jedi >=0.13
+Requires-Dist: exceptiongroup; python_version < "3.11"
+Requires-Dist: jedi>=0.13
 Requires-Dist: matplotlib-inline
-Requires-Dist: prompt-toolkit <3.1.0,>=3.0.41
-Requires-Dist: pygments >=2.4.0
-Requires-Dist: stack-data
-Requires-Dist: traitlets >=5.13.0
-Requires-Dist: exceptiongroup ; python_version < "3.11"
-Requires-Dist: typing-extensions >=4.6 ; python_version < "3.12"
-Requires-Dist: pexpect >4.3 ; sys_platform != "win32" and sys_platform != "emscripten"
-Requires-Dist: colorama ; sys_platform == "win32"
-Provides-Extra: all
-Requires-Dist: ipython[black,doc,kernel,matplotlib,nbconvert,nbformat,notebook,parallel,qtconsole] ; extra == 'all'
-Requires-Dist: ipython[test,test_extra] ; extra == 'all'
+Requires-Dist: pexpect>4.3; sys_platform != "win32" and sys_platform != "emscripten"
+Requires-Dist: prompt_toolkit<3.1.0,>=3.0.41
+Requires-Dist: pygments>=2.4.0
+Requires-Dist: stack_data
+Requires-Dist: traitlets>=5.13.0
+Requires-Dist: typing_extensions>=4.6; python_version < "3.12"
 Provides-Extra: black
-Requires-Dist: black ; extra == 'black'
+Requires-Dist: black; extra == "black"
 Provides-Extra: doc
-Requires-Dist: docrepr ; extra == 'doc'
-Requires-Dist: exceptiongroup ; extra == 'doc'
-Requires-Dist: intersphinx-registry ; extra == 'doc'
-Requires-Dist: ipykernel ; extra == 'doc'
-Requires-Dist: ipython[test] ; extra == 'doc'
-Requires-Dist: matplotlib ; extra == 'doc'
-Requires-Dist: setuptools >=18.5 ; extra == 'doc'
-Requires-Dist: sphinx-rtd-theme ; extra == 'doc'
-Requires-Dist: sphinx >=1.3 ; extra == 'doc'
-Requires-Dist: sphinxcontrib-jquery ; extra == 'doc'
-Requires-Dist: typing-extensions ; extra == 'doc'
-Requires-Dist: tomli ; (python_version < "3.11") and extra == 'doc'
+Requires-Dist: docrepr; extra == "doc"
+Requires-Dist: exceptiongroup; extra == "doc"
+Requires-Dist: intersphinx_registry; extra == "doc"
+Requires-Dist: ipykernel; extra == "doc"
+Requires-Dist: ipython[test]; extra == "doc"
+Requires-Dist: matplotlib; extra == "doc"
+Requires-Dist: setuptools>=18.5; extra == "doc"
+Requires-Dist: sphinx-rtd-theme; extra == "doc"
+Requires-Dist: sphinx>=1.3; extra == "doc"
+Requires-Dist: sphinxcontrib-jquery; extra == "doc"
+Requires-Dist: tomli; python_version < "3.11" and extra == "doc"
+Requires-Dist: typing_extensions; extra == "doc"
 Provides-Extra: kernel
-Requires-Dist: ipykernel ; extra == 'kernel'
-Provides-Extra: matplotlib
-Requires-Dist: matplotlib ; extra == 'matplotlib'
+Requires-Dist: ipykernel; extra == "kernel"
 Provides-Extra: nbconvert
-Requires-Dist: nbconvert ; extra == 'nbconvert'
+Requires-Dist: nbconvert; extra == "nbconvert"
 Provides-Extra: nbformat
-Requires-Dist: nbformat ; extra == 'nbformat'
+Requires-Dist: nbformat; extra == "nbformat"
 Provides-Extra: notebook
-Requires-Dist: ipywidgets ; extra == 'notebook'
-Requires-Dist: notebook ; extra == 'notebook'
+Requires-Dist: ipywidgets; extra == "notebook"
+Requires-Dist: notebook; extra == "notebook"
 Provides-Extra: parallel
-Requires-Dist: ipyparallel ; extra == 'parallel'
+Requires-Dist: ipyparallel; extra == "parallel"
 Provides-Extra: qtconsole
-Requires-Dist: qtconsole ; extra == 'qtconsole'
+Requires-Dist: qtconsole; extra == "qtconsole"
 Provides-Extra: terminal
 Provides-Extra: test
-Requires-Dist: pytest ; extra == 'test'
-Requires-Dist: pytest-asyncio <0.22 ; extra == 'test'
-Requires-Dist: testpath ; extra == 'test'
-Requires-Dist: pickleshare ; extra == 'test'
-Requires-Dist: packaging ; extra == 'test'
-Provides-Extra: test_extra
-Requires-Dist: ipython[test] ; extra == 'test_extra'
-Requires-Dist: curio ; extra == 'test_extra'
-Requires-Dist: matplotlib !=3.2.0 ; extra == 'test_extra'
-Requires-Dist: nbformat ; extra == 'test_extra'
-Requires-Dist: numpy >=1.23 ; extra == 'test_extra'
-Requires-Dist: pandas ; extra == 'test_extra'
-Requires-Dist: trio ; extra == 'test_extra'
+Requires-Dist: pytest; extra == "test"
+Requires-Dist: pytest-asyncio<0.22; extra == "test"
+Requires-Dist: testpath; extra == "test"
+Requires-Dist: pickleshare; extra == "test"
+Requires-Dist: packaging; extra == "test"
+Provides-Extra: test-extra
+Requires-Dist: ipython[test]; extra == "test-extra"
+Requires-Dist: curio; extra == "test-extra"
+Requires-Dist: matplotlib!=3.2.0; extra == "test-extra"
+Requires-Dist: nbformat; extra == "test-extra"
+Requires-Dist: numpy>=1.23; extra == "test-extra"
+Requires-Dist: pandas; extra == "test-extra"
+Requires-Dist: trio; extra == "test-extra"
+Provides-Extra: matplotlib
+Requires-Dist: matplotlib; extra == "matplotlib"
+Provides-Extra: all
+Requires-Dist: ipython[black,doc,kernel,matplotlib,nbconvert,nbformat,notebook,parallel,qtconsole]; extra == "all"
+Requires-Dist: ipython[test,test_extra]; extra == "all"
 
 IPython provides a rich toolkit to help you make the most out of using Python
 interactively.  Its main components are:

+ 3 - 3
contrib/python/ipython/py3/IPython/core/completer.py

@@ -1362,9 +1362,9 @@ def match_dict_keys(
         # All checks passed!
         return True
 
-    filtered_key_is_final: Dict[
-        Union[str, bytes, int, float], _DictKeyState
-    ] = defaultdict(lambda: _DictKeyState.BASELINE)
+    filtered_key_is_final: Dict[Union[str, bytes, int, float], _DictKeyState] = (
+        defaultdict(lambda: _DictKeyState.BASELINE)
+    )
 
     for k in keys:
         # If at least one of the matches is not final, mark as undetermined.

+ 33 - 21
contrib/python/ipython/py3/IPython/core/crashhandler.py

@@ -24,14 +24,17 @@ import traceback
 from pprint import pformat
 from pathlib import Path
 
+import builtins as builtin_mod
+
 from IPython.core import ultratb
+from IPython.core.application import Application
 from IPython.core.release import author_email
 from IPython.utils.sysinfo import sys_info
-from IPython.utils.py3compat import input
 
 from IPython.core.release import __version__ as version
 
-from typing import Optional
+from typing import Optional, Dict
+import types
 
 #-----------------------------------------------------------------------------
 # Code
@@ -84,7 +87,7 @@ Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
 """
 
 
-class CrashHandler(object):
+class CrashHandler:
     """Customizable crash handlers for IPython applications.
 
     Instances of this class provide a :meth:`__call__` method which can be
@@ -95,10 +98,11 @@ class CrashHandler(object):
 
     message_template = _default_message_template
     section_sep = '\n\n'+'*'*75+'\n\n'
+    info: Dict[str, Optional[str]]
 
     def __init__(
         self,
-        app,
+        app: Application,
         contact_name: Optional[str] = None,
         contact_email: Optional[str] = None,
         bug_tracker: Optional[str] = None,
@@ -142,10 +146,14 @@ class CrashHandler(object):
                     bug_tracker = bug_tracker,
                     crash_report_fname = self.crash_report_fname)
 
-
-    def __call__(self, etype, evalue, etb):
+    def __call__(
+        self,
+        etype: type[BaseException],
+        evalue: BaseException,
+        etb: types.TracebackType,
+    ) -> None:
         """Handle an exception, call for compatible with sys.excepthook"""
-        
+
         # do not allow the crash handler to be called twice without reinstalling it
         # this prevents unlikely errors in the crash handling from entering an
         # infinite loop.
@@ -155,21 +163,23 @@ class CrashHandler(object):
         color_scheme = 'NoColor'
 
         # Use this ONLY for developer debugging (keep commented out for release)
-        #color_scheme = 'Linux'   # dbg
-        try:
-            rptdir = self.app.ipython_dir
-        except:
+        # color_scheme = 'Linux'   # dbg
+        ipython_dir = getattr(self.app, "ipython_dir", None)
+        if ipython_dir is not None:
+            assert isinstance(ipython_dir, str)
+            rptdir = Path(ipython_dir)
+        else:
             rptdir = Path.cwd()
-        if rptdir is None or not Path.is_dir(rptdir):
+        if not rptdir.is_dir():
             rptdir = Path.cwd()
         report_name = rptdir / self.crash_report_fname
         # write the report filename into the instance dict so it can get
         # properly expanded out in the user message template
-        self.crash_report_fname = report_name
-        self.info['crash_report_fname'] = report_name
+        self.crash_report_fname = str(report_name)
+        self.info["crash_report_fname"] = str(report_name)
         TBhandler = ultratb.VerboseTB(
             color_scheme=color_scheme,
-            long_header=1,
+            long_header=True,
             call_pdb=self.call_pdb,
         )
         if self.call_pdb:
@@ -195,11 +205,11 @@ class CrashHandler(object):
             print(self.message_template.format(**self.info), file=sys.stderr)
 
             # Construct report on disk
-            report.write(self.make_report(traceback))
+            report.write(self.make_report(str(traceback)))
 
-        input("Hit <Enter> to quit (your terminal may close):")
+        builtin_mod.input("Hit <Enter> to quit (your terminal may close):")
 
-    def make_report(self,traceback):
+    def make_report(self, traceback: str) -> str:
         """Return a string containing a crash report."""
 
         sec_sep = self.section_sep
@@ -211,8 +221,8 @@ class CrashHandler(object):
         try:
             config = pformat(self.app.config)
             rpt_add(sec_sep)
-            rpt_add('Application name: %s\n\n' % self.app_name)
-            rpt_add('Current user configuration structure:\n\n')
+            rpt_add("Application name: %s\n\n" % self.app.name)
+            rpt_add("Current user configuration structure:\n\n")
             rpt_add(config)
         except:
             pass
@@ -221,7 +231,9 @@ class CrashHandler(object):
         return ''.join(report)
 
 
-def crash_handler_lite(etype, evalue, tb):
+def crash_handler_lite(
+    etype: type[BaseException], evalue: BaseException, tb: types.TracebackType
+) -> None:
     """a light excepthook, adding a small message to the usual traceback"""
     traceback.print_exception(etype, evalue, tb)
     

+ 7 - 4
contrib/python/ipython/py3/IPython/core/display.py

@@ -16,7 +16,8 @@ from copy import deepcopy
 from os.path import splitext
 from pathlib import Path, PurePath
 
-from IPython.utils.py3compat import cast_unicode
+from typing import Optional
+
 from IPython.testing.skipdoctest import skip_doctest
 from . import display_functions
 
@@ -518,7 +519,7 @@ class SVG(DisplayObject):
     _read_flags = 'rb'
     # wrap data in a property, which extracts the <svg> tag, discarding
     # document headers
-    _data = None
+    _data: Optional[str] = None
 
     @property
     def data(self):
@@ -540,8 +541,10 @@ class SVG(DisplayObject):
             # fallback on the input, trust the user
             # but this is probably an error.
             pass
-        svg = cast_unicode(svg)
-        self._data = svg
+        if isinstance(svg, bytes):
+            self._data = svg.decode(errors="replace")
+        else:
+            self._data = svg
 
     def _repr_svg_(self):
         return self._data_and_metadata()

+ 92 - 33
contrib/python/ipython/py3/IPython/core/formatters.py

@@ -1,6 +1,61 @@
 # -*- coding: utf-8 -*-
 """Display formatters.
 
+This module defines the base instances in order to implement custom
+formatters/mimetypes
+got objects:
+
+As we want to see internal IPython working we are going to use the following
+function to diaply objects instead of the normal print or display method:
+
+    >>> ip = get_ipython()
+    >>> ip.display_formatter.format(...)
+    ({'text/plain': 'Ellipsis'}, {})
+
+This return a tuple with the mimebumdle for the current object, and the
+associated metadata.
+
+
+We can now define our own formatter and register it:
+
+
+    >>> from IPython.core.formatters import BaseFormatter, FormatterABC
+
+
+    >>> class LLMFormatter(BaseFormatter):
+    ...
+    ...     format_type = 'x-vendor/llm'
+    ...     print_method = '_repr_llm_'
+    ...     _return_type = (dict, str)
+
+    >>> llm_formatter = LLMFormatter(parent=ip.display_formatter)
+
+    >>> ip.display_formatter.formatters[LLMFormatter.format_type] = llm_formatter
+
+Now any class that define `_repr_llm_` will return a x-vendor/llm as part of
+it's display data:
+
+    >>> class A:
+    ...
+    ...     def _repr_llm_(self, *kwargs):
+    ...         return 'This a A'
+    ...
+
+    >>> ip.display_formatter.format(A())
+    ({'text/plain': '<IPython.core.formatters.A at ...>', 'x-vendor/llm': 'This a A'}, {})
+
+As usual, you can register methods for third party types (see
+:ref:`third_party_formatting`)
+
+    >>> def llm_int(obj):
+    ...      return 'This is the integer %s, in between %s and %s'%(obj, obj-1, obj+1)
+
+    >>> llm_formatter.for_type(int, llm_int)
+
+    >>> ip.display_formatter.format(42)
+    ({'text/plain': '42', 'x-vendor/llm': 'This is the integer 42, in between 41 and 43'}, {})
+
+
 Inheritance diagram:
 
 .. inheritance-diagram:: IPython.core.formatters
@@ -37,9 +92,10 @@ class DisplayFormatter(Configurable):
     active_types = List(Unicode(),
         help="""List of currently active mime-types to display.
         You can use this to set a white-list for formats to display.
-        
+
         Most users will not need to change this value.
-        """).tag(config=True)
+        """,
+    ).tag(config=True)
 
     @default('active_types')
     def _active_types_default(self):
@@ -144,7 +200,7 @@ class DisplayFormatter(Configurable):
         """
         format_dict = {}
         md_dict = {}
-        
+
         if self.ipython_display_formatter(obj):
             # object handled itself, don't proceed
             return {}, {}
@@ -176,18 +232,18 @@ class DisplayFormatter(Configurable):
                 continue
             if exclude and format_type in exclude:
                 continue
-            
+
             md = None
             try:
                 data = formatter(obj)
             except:
                 # FIXME: log the exception
                 raise
-            
+
             # formatters can return raw data or (data, metadata)
             if isinstance(data, tuple) and len(data) == 2:
                 data, md = data
-            
+
             if data is not None:
                 format_dict[format_type] = data
             if md is not None:
@@ -252,7 +308,7 @@ class FormatterABC(metaclass=abc.ABCMeta):
 
     # Is the formatter enabled...
     enabled = True
-    
+
     @abc.abstractmethod
     def __call__(self, obj):
         """Return a JSON'able representation of the object.
@@ -278,12 +334,15 @@ def _get_type(obj):
     return getattr(obj, '__class__', None) or type(obj)
 
 
-_raise_key_error = Sentinel('_raise_key_error', __name__, 
-"""
+_raise_key_error = Sentinel(
+    "_raise_key_error",
+    __name__,
+    """
 Special value to raise a KeyError
 
 Raise KeyError in `BaseFormatter.pop` if passed as the default value to `pop`
-""")
+""",
+)
 
 
 class BaseFormatter(Configurable):
@@ -329,7 +388,7 @@ class BaseFormatter(Configurable):
     # The deferred-import type-specific printers.
     # Map (modulename, classname) pairs to the format functions.
     deferred_printers = Dict().tag(config=True)
-    
+
     @catch_format_error
     def __call__(self, obj):
         """Compute the format for an object."""
@@ -348,7 +407,7 @@ class BaseFormatter(Configurable):
             return None
         else:
             return None
-    
+
     def __contains__(self, typ):
         """map in to lookup_by_type"""
         try:
@@ -357,7 +416,7 @@ class BaseFormatter(Configurable):
             return False
         else:
             return True
-    
+
     def _check_return(self, r, obj):
         """Check that a return value is appropriate
 
@@ -372,7 +431,7 @@ class BaseFormatter(Configurable):
                 (self.format_type, type(r), self._return_type, _safe_repr(obj)),
                 FormatterWarning
             )
-    
+
     def lookup(self, obj):
         """Look up the formatter for a given instance.
 
@@ -395,7 +454,7 @@ class BaseFormatter(Configurable):
             return self.singleton_printers[obj_id]
         # then lookup by type
         return self.lookup_by_type(_get_type(obj))
-    
+
     def lookup_by_type(self, typ):
         """Look up the registered formatter for a type.
 
@@ -426,7 +485,7 @@ class BaseFormatter(Configurable):
             for cls in pretty._get_mro(typ):
                 if cls in self.type_printers or self._in_deferred_types(cls):
                     return self.type_printers[cls]
-        
+
         # If we have reached here, the lookup failed.
         raise KeyError("No registered printer for {0!r}".format(typ))
 
@@ -459,15 +518,15 @@ class BaseFormatter(Configurable):
         if isinstance(typ, str):
             type_module, type_name = typ.rsplit('.', 1)
             return self.for_type_by_name(type_module, type_name, func)
-        
+
         try:
             oldfunc = self.lookup_by_type(typ)
         except KeyError:
             oldfunc = None
-        
+
         if func is not None:
             self.type_printers[typ] = func
-        
+
         return oldfunc
 
     def for_type_by_name(self, type_module, type_name, func=None):
@@ -501,16 +560,16 @@ class BaseFormatter(Configurable):
             this will be the previous value (to enable restoring later).
         """
         key = (type_module, type_name)
-        
+
         try:
             oldfunc = self.lookup_by_type("%s.%s" % key)
         except KeyError:
             oldfunc = None
-        
+
         if func is not None:
             self.deferred_printers[key] = func
         return oldfunc
-    
+
     def pop(self, typ, default=_raise_key_error):
         """Pop a formatter for the given type.
 
@@ -529,7 +588,7 @@ class BaseFormatter(Configurable):
         ------
         KeyError if the type is not registered and default is not specified.
         """
-        
+
         if isinstance(typ, str):
             typ_key = tuple(typ.rsplit('.',1))
             if typ_key not in self.deferred_printers:
@@ -599,14 +658,14 @@ class PlainTextFormatter(BaseFormatter):
     # This subclass ignores this attribute as it always need to return
     # something.
     enabled = Bool(True).tag(config=False)
-    
+
     max_seq_length = Integer(pretty.MAX_SEQ_LENGTH,
         help="""Truncate large collections (lists, dicts, tuples, sets) to this size.
-        
+
         Set to 0 to disable truncation.
-        """
+        """,
     ).tag(config=True)
-    
+
     # Look for a _repr_pretty_ methods to use for pretty printing.
     print_method = ObjectName('_repr_pretty_')
 
@@ -775,7 +834,7 @@ class PNGFormatter(BaseFormatter):
     format_type = Unicode('image/png')
 
     print_method = ObjectName('_repr_png_')
-    
+
     _return_type = (bytes, str)
 
 
@@ -829,7 +888,7 @@ class JSONFormatter(BaseFormatter):
     _return_type = (list, dict)
 
     print_method = ObjectName('_repr_json_')
-    
+
     def _check_return(self, r, obj):
         """Check that a return value is appropriate
 
@@ -887,19 +946,19 @@ class PDFFormatter(BaseFormatter):
 
 class IPythonDisplayFormatter(BaseFormatter):
     """An escape-hatch Formatter for objects that know how to display themselves.
-    
+
     To define the callables that compute the representation of your
     objects, define a :meth:`_ipython_display_` method or use the :meth:`for_type`
     or :meth:`for_type_by_name` methods to register functions that handle
     this. Unlike mime-type displays, this method should not return anything,
     instead calling any appropriate display methods itself.
-    
+
     This display formatter has highest priority.
     If it fires, no other display formatter will be called.
 
     Prior to IPython 6.1, `_ipython_display_` was the only way to display custom mime-types
     without registering a new Formatter.
-    
+
     IPython 6.1 introduces `_repr_mimebundle_` for displaying custom mime-types,
     so `_ipython_display_` should only be used for objects that require unusual
     display patterns, such as multiple display calls.
@@ -943,7 +1002,7 @@ class MimeBundleFormatter(BaseFormatter):
     """
     print_method = ObjectName('_repr_mimebundle_')
     _return_type = dict
-    
+
     def _check_return(self, r, obj):
         r = super(MimeBundleFormatter, self)._check_return(r, obj)
         # always return (data, metadata):

+ 6 - 9
contrib/python/ipython/py3/IPython/core/guarded_eval.py

@@ -44,20 +44,17 @@ else:
 
 @undoc
 class HasGetItem(Protocol):
-    def __getitem__(self, key) -> None:
-        ...
+    def __getitem__(self, key) -> None: ...
 
 
 @undoc
 class InstancesHaveGetItem(Protocol):
-    def __call__(self, *args, **kwargs) -> HasGetItem:
-        ...
+    def __call__(self, *args, **kwargs) -> HasGetItem: ...
 
 
 @undoc
 class HasGetAttr(Protocol):
-    def __getattr__(self, key) -> None:
-        ...
+    def __getattr__(self, key) -> None: ...
 
 
 @undoc
@@ -329,9 +326,9 @@ class EvaluationContext(NamedTuple):
     #: Global namespace
     globals: dict
     #: Evaluation policy identifier
-    evaluation: Literal[
-        "forbidden", "minimal", "limited", "unsafe", "dangerous"
-    ] = "forbidden"
+    evaluation: Literal["forbidden", "minimal", "limited", "unsafe", "dangerous"] = (
+        "forbidden"
+    )
     #: Whether the evaluation of code takes place inside of a subscript.
     #: Useful for evaluating ``:-1, 'col'`` in ``df[:-1, 'col']``.
     in_subscript: bool = False

+ 1 - 0
contrib/python/ipython/py3/IPython/core/inputsplitter.py

@@ -15,6 +15,7 @@ and stores the results.
 
 For more details, see the class docstrings below.
 """
+
 from __future__ import annotations
 
 from warnings import warn

+ 4 - 1
contrib/python/ipython/py3/IPython/core/inputtransformer2.py

@@ -395,7 +395,10 @@ def _tr_quote2(content):
 
 def _tr_paren(content):
     "Translate lines escaped with a slash: /"
-    name, _, args = content.partition(' ')
+    name, _, args = content.partition(" ")
+    if name == "":
+        raise SyntaxError(f'"{ESC_SHELL}" must be followed by a callable name')
+
     return '%s(%s)' % (name, ", ".join(args.split()))
 
 tr = { ESC_SHELL  : 'get_ipython().system({!r})'.format,

+ 2 - 2
contrib/python/ipython/py3/IPython/core/magics/basic.py

@@ -461,7 +461,7 @@ Currently the magic system has the following functions:""",
             ptformatter.pprint = False
             disp_formatter.active_types = ['text/plain']
 
-            shell.magic('xmode Plain')
+            shell.run_line_magic("xmode", "Plain")
         else:
             # turn off
             shell.separate_in = dstore.rc_separate_in
@@ -472,7 +472,7 @@ Currently the magic system has the following functions:""",
             ptformatter.pprint = dstore.rc_pprint
             disp_formatter.active_types = dstore.rc_active_types
 
-            shell.magic('xmode ' + dstore.xmode)
+            shell.run_line_magic("xmode", dstore.xmode)
 
         # mode here is the state before we switch; switch_doctest_mode takes
         # the mode we're switching to.

+ 2 - 2
contrib/python/ipython/py3/IPython/core/magics/logging.py

@@ -83,14 +83,14 @@ class LoggingMagics(Magics):
             log 'raw' input.  Normally, IPython's logs contain the processed
             input, so that user lines are logged in their final form, converted
             into valid Python.  For example, %Exit is logged as
-            _ip.magic("Exit").  If the -r flag is given, all input is logged
+            _ip.run_line_magic("Exit").  If the -r flag is given, all input is logged
             exactly as typed, with no transformations applied.
 
           -t
             put timestamps before each input line logged (these are put in
             comments).
 
-          -q 
+          -q
             suppress output of logstate message when logging is invoked
         """
 

Some files were not shown because too many files changed in this diff