Hello community,

here is the log from the commit of package python-python-language-server for 
openSUSE:Factory checked in at 2020-04-14 15:11:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-python-language-server (Old)
 and      /work/SRC/openSUSE:Factory/.python-python-language-server.new.2738 
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-python-language-server"

Tue Apr 14 15:11:58 2020 rev:6 rq:793824 version:0.31.9

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-python-language-server/python-python-language-server.changes
      2020-03-23 12:53:21.288061697 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-python-language-server.new.2738/python-python-language-server.changes
    2020-04-14 16:32:21.464153109 +0200
@@ -1,0 +2,13 @@
+Mon Apr 13 10:39:13 UTC 2020 - Benjamin Greiner <c...@bnavigator.de>
+
+- add pyls-pr778-multiplerefs.patch from 
gh#palantir/python-language-server#778 
+
+-------------------------------------------------------------------
+Thu Apr  9 22:52:32 UTC 2020 - Benjamin Greiner <c...@bnavigator.de>
+
+- update to newer jedi but deal with gh#palantir/python-language-server#744
+  pyls-pr775-jedi016.patch from gh#palantir/python-language-server#775
+  pyls-pr775-addon.patch on top of it (PR submitted)
+- reactivate the unit tests 
+
+-------------------------------------------------------------------

New:
----
  pyls-pr775-addon.patch
  pyls-pr775-jedi016.patch
  pyls-pr778-multiplerefs.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-python-language-server.spec ++++++
--- /var/tmp/diff_new_pack.Z2Bpun/_old  2020-04-14 16:32:21.960153487 +0200
+++ /var/tmp/diff_new_pack.Z2Bpun/_new  2020-04-14 16:32:21.964153491 +0200
@@ -23,12 +23,14 @@
 Release:        0
 Summary:        Python Language Server for the Language Server Protocol
 License:        MIT
-Group:          Development/Languages/Python
 URL:            https://github.com/palantir/python-language-server
 Source:         
https://files.pythonhosted.org/packages/source/p/python-language-server/python-language-server-%{version}.tar.gz
 # PATCH-FIX-OPENSUSE use_newer_ujson.patch mc...@suse.com
 # Use system python3-ujson without regards which version it is
 Patch0:         use_newer_ujson.patch
+Patch1:         pyls-pr775-jedi016.patch
+Patch2:         pyls-pr775-addon.patch
+Patch3:         pyls-pr778-multiplerefs.patch
 BuildRequires:  %{python_module PyQt5}
 BuildRequires:  %{python_module autopep8}
 BuildRequires:  %{python_module flake8}
@@ -47,7 +49,7 @@
 BuildRequires:  %{python_module yapf}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
-Requires:       python-jedi >= 0.14.1
+Requires:       python-jedi >= 0.16
 Requires:       python-pluggy
 Requires:       python-python-jsonrpc-server >= 0.3.2
 Requires:       python-setuptools
@@ -61,7 +63,7 @@
 Recommends:     python-rope >= 0.10.5
 BuildArch:      noarch
 # SECTION test requirements
-BuildRequires:  %{python_module jedi >= 0.14.1}
+BuildRequires:  %{python_module jedi >= 0.16}
 BuildRequires:  %{python_module mock}
 BuildRequires:  %{python_module pluggy}
 BuildRequires:  %{python_module pytest}
@@ -105,18 +107,25 @@
 
 %check
 # Tests are switched off ATM, because of gh#palantir/python-language-server#744
-# # Remove pytest addopts
-# rm setup.cfg
-# # One test failure on Leap 15.1 due to different pylint version
-# %%if 0%{?sle_version} == 150100 && 0%{?is_opensuse}
-# %%define skip_tests -k not 'test_syntax_error_pylint_py3'
-# %%endif
-# %%pytest %{?skip_tests}
+# Remove pytest addopts
+rm setup.cfg
+# unclean tear down
+skip_tests="test_missing_message"
+# Test failure on Leap 15.1 due to different pylint version
+%if 0%{?sle_version} == 150100 && 0%{?is_opensuse}
+  skip_tests+=" or test_syntax_error_pylint_py"
+%endif
+# unknown encoding utd-8 on python2
+%ifpython2
+  skip_tests+=" or test_references_builtin"
+%endif
+%pytest  -k "not ( $skip_tests )"
 
 %files %{python_files}
 %doc README.rst
 %license LICENSE
 %python3_only %{_bindir}/pyls
-%{python_sitelib}/*
+%{python_sitelib}/python_language_server-%{version}-py*.egg-info
+%{python_sitelib}/pyls/
 
 %changelog

++++++ pyls-pr775-addon.patch ++++++
diff --git a/pyls/plugins/jedi_completion.py b/pyls/plugins/jedi_completion.py
index 9106c3c..5c9c358 100644
--- a/pyls/plugins/jedi_completion.py
+++ b/pyls/plugins/jedi_completion.py
@@ -53,18 +53,22 @@ def pyls_completions(config, document, position):
     try:
         code_position = {}
         if position:
-            code_position = {'line': position['line'] + 1,
-                             'column': 
_utils.clip_column(position['character'], document.lines, position['line'])}
-        definitions = document.jedi_script().complete(**code_position)
+            code_position = {
+                'line': position['line'] + 1,
+                'column': _utils.clip_column(position['character'],
+                                             document.lines,
+                                             position['line'])}
+        completions = document.jedi_script().complete(**code_position)
     except AttributeError as e:
         if 'CompiledObject' in str(e):
             # Needed to handle missing CompiledObject attribute
             # 'sub_modules_dict'
-            definitions = None
+            # TODO: probably not needed for new Complete objects
+            completions = None
         else:
             raise e
 
-    if not definitions:
+    if not completions:
         return None
 
     completion_capabilities = config.capabilities.get('textDocument', 
{}).get('completion', {})
@@ -73,7 +77,7 @@ def pyls_completions(config, document, position):
     settings = config.plugin_settings('jedi_completion', 
document_path=document.path)
     should_include_params = settings.get('include_params')
     include_params = snippet_support and should_include_params and 
use_snippets(document, position)
-    return [_format_completion(signature, include_params) for d in definitions 
for signature in d.get_signatures()] or None
+    return [_format_completion(c, include_params) for c in completions] or None
 
 
 def is_exception_class(name):
@@ -142,9 +146,9 @@ def _format_completion(d, include_params=True):
         path = path.replace('/', '\\/')
         completion['insertText'] = path
 
-    if (include_params and hasattr(d, 'params') and d.params and
-            not is_exception_class(d.name)):
-        positional_args = [param for param in d.params
+    sig = d.get_signatures()
+    if (include_params and sig and not is_exception_class(d.name)):
+        positional_args = [param for param in sig[0].params
                            if '=' not in param.description and
                            param.name not in {'/', '*'}]
 
@@ -167,8 +171,9 @@ def _format_completion(d, include_params=True):
 
 
 def _label(definition):
-    if definition.type in ('function', 'method') and hasattr(definition, 
'params'):
-        params = ', '.join([param.name for param in definition.params])
+    sig = definition.get_signatures()
+    if definition.type in ('function', 'method') and sig:
+        params = ', '.join([param.name for param in sig[0].params])
         return '{}({})'.format(definition.name, params)
 
     return definition.name
diff --git a/pyls/workspace.py b/pyls/workspace.py
index f5c7237..05ca83e 100644
--- a/pyls/workspace.py
+++ b/pyls/workspace.py
@@ -213,16 +213,9 @@ class Document(object):
         return m_start[0] + m_end[-1]
 
     def jedi_names(self, all_scopes=False, definitions=True, references=False):
-        environment_path = None
-        if self._config:
-            jedi_settings = self._config.plugin_settings('jedi', 
document_path=self.path)
-            environment_path = jedi_settings.get('environment')
-        environment = self.get_enviroment(environment_path) if 
environment_path else None
-
-        return jedi.api.names(
-            source=self.source, path=self.path, all_scopes=all_scopes,
-            definitions=definitions, references=references, 
environment=environment,
-        )
+        script = self.jedi_script()
+        return script.get_names(all_scopes=all_scopes, definitions=definitions,
+                                references=references)
 
     def jedi_script(self, position=None):
         extra_paths = []
++++++ pyls-pr775-jedi016.patch ++++++
diff --git a/pyls/plugins/jedi_completion.py b/pyls/plugins/jedi_completion.py
index caa543a1..9106c3c1 100644
--- a/pyls/plugins/jedi_completion.py
+++ b/pyls/plugins/jedi_completion.py
@@ -51,7 +51,11 @@
 @hookimpl
 def pyls_completions(config, document, position):
     try:
-        definitions = document.jedi_script(position).completions()
+        code_position = {}
+        if position:
+            code_position = {'line': position['line'] + 1,
+                             'column': 
_utils.clip_column(position['character'], document.lines, position['line'])}
+        definitions = document.jedi_script().complete(**code_position)
     except AttributeError as e:
         if 'CompiledObject' in str(e):
             # Needed to handle missing CompiledObject attribute
@@ -69,7 +73,7 @@ def pyls_completions(config, document, position):
     settings = config.plugin_settings('jedi_completion', 
document_path=document.path)
     should_include_params = settings.get('include_params')
     include_params = snippet_support and should_include_params and 
use_snippets(document, position)
-    return [_format_completion(d, include_params) for d in definitions] or None
+    return [_format_completion(signature, include_params) for d in definitions 
for signature in d.get_signatures()] or None
 
 
 def is_exception_class(name):
@@ -173,7 +177,7 @@ def _label(definition):
 def _detail(definition):
     try:
         return definition.parent().full_name or ''
-    except AttributeError:
+    except (AttributeError, TypeError):
         return definition.full_name or ''
 
++++++ pyls-pr778-multiplerefs.patch ++++++
>From 26bc48c9f3bec3671fcc39a60e2381ba4214c638 Mon Sep 17 00:00:00 2001
From: Benjamin Greiner <grei...@dsi.uni-stuttgart.de>
Date: Fri, 10 Apr 2020 00:46:03 +0200
Subject: [PATCH] fix references test

---
 test/plugins/test_references.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/plugins/test_references.py b/test/plugins/test_references.py
index 6caab4c4..7e7cbe75 100644
--- a/test/plugins/test_references.py
+++ b/test/plugins/test_references.py
@@ -73,7 +73,7 @@ def test_references_builtin(tmp_workspace):  # pylint: 
disable=redefined-outer-n
     doc2 = Document(doc2_uri)
 
     refs = pyls_references(doc2, position)
-    assert len(refs) == 1
+    assert len(refs) >= 1
 
     assert refs[0]['range']['start'] == {'line': 4, 'character': 7}
     assert refs[0]['range']['end'] == {'line': 4, 'character': 19}

Reply via email to