Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pylance autocompletes decorator of the function instead of function itself in inheritance #6450

Open
mmzeynalli opened this issue Sep 25, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@mmzeynalli
Copy link

Environment data

  • Pylance version: v2024.9.2
  • OS and version: Windows 11
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.11

Code Snippet

class ApiResponse(BaseModel, Generic[ResponseType]):
    body: ResponseType

class SyncApiRequest:
    def __call__(self, *args: Any, **kwds: Any):
        pass


def send_request(func: Callable[..., ApiResponse]):
    def wrapper(self, *args, **kwargs) -> ApiResponse:
        func(self, *args, **kwargs)
        return self.__call__()

    return wrapper

class Request(SyncApiRequest):
    @send_request
    def save_card(self) -> ApiResponse:
        self.path = '/api/1/card-registration'
        self.verb = 'POST'

class AsyncRequest(Request):
    async def save_card(self, **extra) -> ApiResponse[EPointRedirectUrlResponseSchema]:
        return await super().save_card(**extra)

Repro Steps

  1. In AsyncRequest class, try to write save_, and autocomplete with Pylance.

Expected behavior

It autocompletes as in code above

Actual behavior

image
image

It does it for decorator, instead of save_card function.

Logs

2024-09-25 14:04:00.517 [info] (28636) [FG] parsing: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (1ms)
2024-09-25 14:04:00.517 [info] (28636) [FG] binding: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (1ms)
2024-09-25 14:04:00.566 [info] [Info  - 2:04:00 PM] (28636) Heap stats: total_memory_size=48771MB, total_free_size=33713MB, total_heap_size=113MB, used_heap_size=102MB, cross_worker_used_heap_size=102MB, total_physical_size=113MB, total_available_size=3990MB, heap_size_limit=4096MB
2024-09-25 14:04:00.767 [info] (28636) [BG(1)] analyzing: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py ...
2024-09-25 14:04:00.767 [info] (28636) [BG(1)]   parsing: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (1ms)
2024-09-25 14:04:00.767 [info] (28636) [BG(1)]   binding: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (0ms)
2024-09-25 14:04:00.812 [info] (28636) [BG(1)]   checking: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (45ms)
2024-09-25 14:04:00.812 [info] [Info  - 2:04:00 PM] (28636) Heap stats: total_memory_size=48771MB, total_free_size=33706MB, total_heap_size=100MB, used_heap_size=91MB, cross_worker_used_heap_size=91MB, total_physical_size=100MB, total_available_size=4001MB, heap_size_limit=4096MB
2024-09-25 14:04:00.812 [info] (28636) [BG(1)] analyzing: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (46ms)
2024-09-25 14:04:00.813 [info] (28636) [BG(1)] analyzing: untitled:Untitled-1 ...
2024-09-25 14:04:00.813 [info] (28636) [BG(1)]   checking: untitled:Untitled-1 (1ms)
2024-09-25 14:04:00.813 [info] (28636) [BG(1)] analyzing: untitled:Untitled-1 (1ms)
2024-09-25 14:04:00.815 [info] (28636) [BG(1)] SemanticTokens delta previousResultId:1727265801511 at file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (0ms)
2024-09-25 14:04:00.815 [info] (28636) [BG(1)] indexing: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py [found 3] (0ms)
2024-09-25 14:04:00.815 [info] (28636) Indexing Done: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py
2024-09-25 14:04:00.820 [info] (28636) [BG(1)] SemanticTokens delta previousResultId:1727265840813 at file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (0ms)
2024-09-25 14:04:01.754 [info] (28636) [FG] parsing: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (1ms)
2024-09-25 14:04:01.755 [info] (28636) [FG] binding: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (0ms)
2024-09-25 14:04:01.800 [info] (28636) [BG(1)] analyzing: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py ...
2024-09-25 14:04:01.800 [info] (28636) [BG(1)]   parsing: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (0ms)
2024-09-25 14:04:01.800 [info] (28636) [BG(1)]   binding: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (1ms)
2024-09-25 14:04:01.842 [info] (28636) [BG(1)]   checking: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (42ms)
2024-09-25 14:04:01.843 [info] [Info  - 2:04:01 PM] (28636) Heap stats: total_memory_size=48771MB, total_free_size=33705MB, total_heap_size=108MB, used_heap_size=95MB, cross_worker_used_heap_size=95MB, total_physical_size=108MB, total_available_size=3998MB, heap_size_limit=4096MB
2024-09-25 14:04:01.843 [info] (28636) [BG(1)] analyzing: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (43ms)
2024-09-25 14:04:01.844 [info] (28636) [BG(1)] analyzing: untitled:Untitled-1 ...
2024-09-25 14:04:01.844 [info] (28636) [BG(1)]   checking: untitled:Untitled-1 (1ms)
2024-09-25 14:04:01.844 [info] (28636) [BG(1)] analyzing: untitled:Untitled-1 (1ms)
2024-09-25 14:04:01.845 [info] (28636) [BG(1)] indexing: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py [found 3] (0ms)
2024-09-25 14:04:01.845 [info] (28636) Indexing Done: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py
2024-09-25 14:04:01.848 [info] (28636) [BG(1)] SemanticTokens delta previousResultId:1727265840813 at file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (1ms)
2024-09-25 14:04:03.710 [info] (28636) [FG] parsing: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (1ms)
2024-09-25 14:04:03.711 [info] (28636) [FG] binding: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (0ms)
2024-09-25 14:04:03.757 [info] (28636) [BG(1)] analyzing: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py ...
2024-09-25 14:04:03.758 [info] (28636) [BG(1)]   parsing: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (2ms)
2024-09-25 14:04:03.758 [info] (28636) [BG(1)]   binding: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (0ms)
2024-09-25 14:04:03.813 [info] (28636) [BG(1)]   checking: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (55ms)
2024-09-25 14:04:03.813 [info] [Info  - 2:04:03 PM] (28636) Heap stats: total_memory_size=48771MB, total_free_size=33713MB, total_heap_size=113MB, used_heap_size=82MB, cross_worker_used_heap_size=82MB, total_physical_size=113MB, total_available_size=4010MB, heap_size_limit=4096MB
2024-09-25 14:04:03.813 [info] (28636) [BG(1)] analyzing: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (57ms)
2024-09-25 14:04:03.813 [info] (28636) [BG(1)] SemanticTokens delta previousResultId:1727265841847 at file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (1ms)
2024-09-25 14:04:03.815 [info] (28636) [BG(1)] analyzing: untitled:Untitled-1 ...
2024-09-25 14:04:03.815 [info] (28636) [BG(1)]   checking: untitled:Untitled-1 (1ms)
2024-09-25 14:04:03.816 [info] (28636) [BG(1)] analyzing: untitled:Untitled-1 (1ms)
2024-09-25 14:04:03.816 [info] (28636) [BG(1)] indexing: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py [found 3] (0ms)
2024-09-25 14:04:03.816 [info] (28636) Indexing Done: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py
2024-09-25 14:04:03.817 [info] (28636) [BG(1)] SemanticTokens delta previousResultId:1727265843812 at file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py (0ms)
2024-09-25 14:04:03.847 [info] [Info  - 2:04:03 PM] (28636) SourceFile: Received fs event 'change' for path 'c:\Users\mirad\Documents\Projects\epoint\integrify\epoint\asyncio.py'
2024-09-25 14:04:04.330 [info] (28636) [BG(1)] indexing: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py [found 3] (0ms)
2024-09-25 14:04:04.331 [info] (28636) Indexing Done: file:///c%3A/Users/mirad/Documents/Projects/epoint/integrify/epoint/asyncio.py

@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Sep 25, 2024
@mmzeynalli mmzeynalli changed the title Pylance autocompletes decorator function instead of function itself Pylance autocompletes decorator function instead of function itself in inheritance Sep 25, 2024
@mmzeynalli mmzeynalli changed the title Pylance autocompletes decorator function instead of function itself in inheritance Pylance autocompletes decorator of the function instead of function itself in inheritance Sep 25, 2024
@KacieKK
Copy link
Contributor

KacieKK commented Sep 28, 2024

Thanks for reporting. I can repro.

@KacieKK KacieKK added bug Something isn't working and removed needs repro Issue has not been reproduced yet labels Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants