File ipython-jedi018.patch of Package python-ipython

From 5e979ec2119487e0d6ac33292f07ab62826645a5 Mon Sep 17 00:00:00 2001
From: Diego Fernandez <aiguo.fernandez@gmail.com>
Date: Thu, 26 Mar 2020 14:07:22 -0600
Subject: [PATCH 1/3] Backport PR #12207 on 7.x

This should make jedi 0.18 compatible with 7.x.

Pinning is not an option as the resolver is free to pick older IPython
with jedi 0.18

  --

Bump jedi to at least 0.16.0 and fix deprecated function usage
---
 IPython/core/completer.py   |   22 +++++++++++-----------
 IPython/terminal/ptutils.py |    2 ++
 setup.py                    |    2 +-
 3 files changed, 14 insertions(+), 12 deletions(-)

Index: ipython-7.16.1/IPython/core/completer.py
===================================================================
--- ipython-7.16.1.orig/IPython/core/completer.py
+++ ipython-7.16.1/IPython/core/completer.py
@@ -110,26 +110,23 @@ current development version to get bette
 # Copyright (C) 2001 Python Software Foundation, www.python.org
 
 
-import __main__
 import builtins as builtin_mod
 import glob
-import time
 import inspect
 import itertools
 import keyword
 import os
 import re
+import string
 import sys
+import time
 import unicodedata
-import string
 import warnings
-
 from contextlib import contextmanager
 from importlib import import_module
-from typing import Iterator, List, Tuple, Iterable
 from types import SimpleNamespace
+from typing import Iterable, Iterator, List, Tuple
 
-from traitlets.config.configurable import Configurable
 from IPython.core.error import TryNext
 from IPython.core.inputtransformer2 import ESC_MAGIC
 from IPython.core.latex_symbols import latex_symbols, reverse_latex_symbol
@@ -137,7 +134,10 @@ from IPython.core.oinspect import Inspec
 from IPython.utils import generics
 from IPython.utils.dir2 import dir2, get_real_method
 from IPython.utils.process import arg_split
-from traitlets import Bool, Enum, observe, Int
+from traitlets import Bool, Enum, Int, observe
+from traitlets.config.configurable import Configurable
+
+import __main__
 
 # skip module docstests
 skip_doctest = True
@@ -987,8 +987,17 @@ def _make_signature(completion)-> str:
     `(a, *args, b=1, **kwargs)`
 
     """
+    # it looks like this might work on jedi 0.17
+    if hasattr(completion, 'get_signatures'):
+        signatures = completion.get_signatures()
+        if not signatures:
+            return  '(?)'
+
+        c0 = completion.get_signatures()[0]
+        return '('+c0.to_string().split('(', maxsplit=1)[1]
 
-    return '(%s)'% ', '.join([f for f in (_formatparamchildren(p) for p in completion.params) if f])
+    return '(%s)'% ', '.join([f for f in (_formatparamchildren(p) for signature in completion.get_signatures()
+                                          for p in signature.defined_names()) if f])
 
 class IPCompleter(Completer):
     """Extension of the completer class with IPython-specific features"""
@@ -1370,8 +1379,7 @@ class IPCompleter(Completer):
                 else:
                     raise ValueError("Don't understand self.omit__names == {}".format(self.omit__names))
 
-        interpreter = jedi.Interpreter(
-            text[:offset], namespaces, column=cursor_column, line=cursor_line + 1)
+        interpreter = jedi.Interpreter(text[:offset], namespaces)
         try_jedi = True
 
         try:
@@ -1398,7 +1406,7 @@ class IPCompleter(Completer):
         if not try_jedi:
             return []
         try:
-            return filter(completion_filter, interpreter.completions())
+            return filter(completion_filter, interpreter.complete(column=cursor_column, line=cursor_line + 1))
         except Exception as e:
             if self.debug:
                 return [_FakeJediCompletion('Oops Jedi has crashed, please report a bug with the following:\n"""\n%s\ns"""' % (e))]
Index: ipython-7.16.1/IPython/terminal/ptutils.py
===================================================================
--- ipython-7.16.1.orig/IPython/terminal/ptutils.py
+++ ipython-7.16.1/IPython/terminal/ptutils.py
@@ -9,6 +9,8 @@ not to be used outside IPython.
 
 import unicodedata
 from wcwidth import wcwidth
+import sys
+import traceback
 
 from IPython.core.completer import (
     provisionalcompleter, cursor_to_position,
Index: ipython-7.16.1/setup.py
===================================================================
--- ipython-7.16.1.orig/setup.py
+++ ipython-7.16.1/setup.py
@@ -186,7 +186,7 @@ extras_require = dict(
 
 install_requires = [
     'setuptools>=18.5',
-    'jedi>=0.10',
+    'jedi>=0.16',
     'decorator',
     'pickleshare',
     'traitlets>=4.2',
openSUSE Build Service is sponsored by