Pylance-release: self is not accessed in async/sync method in class

Created on 3 Nov 2020  路  3Comments  路  Source: microsoft/pylance-release

Environment data

from starlette.middleware.base import BaseHTTPMiddleware
from starlette.types import ASGIApp, Receive, Scope, Send


class CashMiddleware(BaseHTTPMiddleware):
    async def dispatch(self, request, call_next): # "self" is not accessed Pylance
        response = await call_next(request)
        response.headers['Custom'] = 'Example'
        return response
triage

Most helpful comment

Yeah, this is intended in order to get the graying out behavior. VS Code shouldn't show squiggles, just the visual effect (and doesn't show up in the "problems" panel either).

See #434 (but I believe there are others).

All 3 comments

The symbol "self" is not accessed in the above snippet. All unaccessed function parameters are displayed as "grayed out" by Pylance as a subtle hint that it is not accessed. This is how it is intended to work.

Yeah, this is intended in order to get the graying out behavior. VS Code shouldn't show squiggles, just the visual effect (and doesn't show up in the "problems" panel either).

See #434 (but I believe there are others).

thx

Was this page helpful?
0 / 5 - 0 ratings

Related issues

martinjohndyer picture martinjohndyer  路  4Comments

flaree picture flaree  路  4Comments

PedroMDuarte picture PedroMDuarte  路  5Comments

andyljones picture andyljones  路  5Comments

notatallshaw picture notatallshaw  路  4Comments