microsoft / python-language-server

Microsoft Language Server for Python
Apache License 2.0
910 stars 130 forks source link

A way to silence 'x' is not accessed #2169

Closed mangelozzi closed 2 years ago

mangelozzi commented 2 years ago

Say one has this code:

    def has_delete_permission(self, request, obj=None):
        return False

It will say obj is not accessed, so then one changes it to:

    def has_delete_permission(self, request, _=None):  # _ = obj
        return False

Then it says request is not accessed. Renaming request to _, also doesn't work because then its a duplicate argument. renaming it to __ doesnt silence it either. Would be nice to silence the warning without losing what the arguments are, and when there are more than one.

Describe the feature you'd like

A way to silence the warning when its known they are not accessed, e.g. A function whose prototype may change, but must always return False is marked that some of the args are not accessed with the comment # pyls_not_accesed

    def has_change_permission(self, *args, **kwargs):  # pyls_not_accesed
        return False
judej commented 2 years ago

Thank you for the report. This project is no longer active. If you are using the Python language server in VSCode, the language server you are using is Pylance and please the http://github.com/microsoft/pylance-release to report issues.

If you are using Visual Studio, then, please use http://github.com/microsoft/PTVS to report issues.

thank you