question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pyls-mypy messages are not displayed correctly in some cases

See original GitHub issue

Related to #3045

Problem Description

Some error messages from pyls-mypy are not displayed correctly. In general it happens for complicated error messages including generic types like List[T]. As far as I can see the output form pyls-mypy is correct and contains correct string.

What steps reproduce the problem?

  1. Install pyls-mypy using pip

  2. Type the following code in spyder and observe the reported code analysis message :

from typing import List

def f(*arg : List[float]) -> float:

    a1,a2 = arg

    return a1*a2

What is the expected output? What do you see instead?

Expected output is:

Incompatible return value type (got "List[float]", expected "float")

What I see is just the end of that msg:

", expected "float")

Versions

  • Spyder version: 4.0.0
  • Python version: 3.7.3
  • Qt version: 5.12.5
  • PyQt version: 5.12.3
  • Operating System name/version: Windows 10

Dependencies

cloudpickle >=0.5.0          :  1.2.2 (OK)
pygments >=2.0               :  2.5.2 (OK)
qtconsole >=4.6.0            :  4.6.0 (OK)
nbconvert >=4.0              :  5.6.1 (OK)
sphinx >=0.6.6               :  2.3.0 (OK)
pylint >=0.25                :  2.4.4 (OK)
psutil >=0.3                 :  5.6.7 (OK)
qtawesome >=0.5.7            :  0.6.0 (OK)
qtpy >=1.5.0                 :  1.9.0 (OK)
pickleshare >=0.4            :  0.7.5 (OK)
zmq >=17                     :  18.1.1 (OK)
chardet >=2.0.0              :  3.0.4 (OK)
numpydoc >=0.6.0             :  0.9.1 (OK)
spyder_kernels >=1.8.1;<2.0.0:  1.8.1 (OK)
qdarkstyle >=2.7             :  2.7 (OK)
atomicwrites >=1.2.0         :  1.3.0 (OK)
diff_match_patch >=20181111  :  20181111 (OK)
intervaltree                 :  None (OK)
watchdog                     :  None (OK)
keyring                      :  None (OK)
pexpect >=4.4.0              :  4.7.0 (OK)
pympler                      :  None (OK)
sympy >=0.7.3                :  None (NOK)
cython >=0.21                :  None (NOK)
IPython >=4.0                :  7.10.2 (OK)
matplotlib >=2.0.0           :  None (NOK)
pandas >=0.13.1              :  None (NOK)
numpy >=1.7                  :  None (NOK)
scipy >=0.17.0               :  None (NOK)
pyls >=0.31.2;<0.32.0        :  0.31.2 (OK)
rtree >=0.8.3                :  0.9.3 (OK)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Richardk2ncommented, Apr 26, 2020

Changing lines 2504 - 2506

if '[' in msg and ']' in msg:
                # Remove extra redundant info from pyling messages
                msg = msg.split(']')[-1]

To something like

if src == 'pylint' and '[' in msg and ']' in msg:
                # Remove extra redundant info from pyling messages
                msg = msg.split(']')[-1]

should do the trick imho.

1reaction
Richardk2ncommented, Apr 25, 2020

spyder/plugins/editor/widgets/codeeditor.py line 2506 is msg = msg.split(']')[-1] Might be the cause of the problem.

If you want a quick and easy workaround insert a msg.replace("]", "&#93;") into your pyls_mypy/plugin.py

Read more comments on GitHub >

github_iconTop Results From Across the Web

emacs-lsp/lsp-mode - Gitter
So, it appears that in order for mypy to work with pyls , a special package needs installing. If you've got a package...
Read more >
Need help trying to create a function that auto loads a python ...
I am trying to get emacs to first check if the current projectile directory has a .venv directory, and if so then load...
Read more >
2019-February.txt - Checkmk
In case the later could not be fetched the processing of the management ... a service discovery yet show a more helpful status...
Read more >
Simple index - piwheels
... firebat-console mu-message smcompy glare-dev neuron-cc ae-files cardberg kvxopt enzyme py-gee-tools pupil-labs-uvc a-sqlbuilder gridtlib score-session ...
Read more >
jupyterlab-lsp - Bountysource
Hi, I'm working on JupyterLab-RTC, trying out some extensions to check we are not breaking extensions. When trying out this extension, I got...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found