Skip to content

Pylance Typing checking error for AsyncTransaction #1015

Closed
@eric-nguyen-cs

Description

@eric-nguyen-cs

Bug Report

Screenshot 2024-01-31 at 11 52 15

I am using the AsyncTransaction context manager

 async with txn_manager as _txn:
    ...

However, the Pylance VSCode extension (powered by Pyright) in Basic Type checking mode is giving a type error:
Object of type "AsyncTransaction" cannot be used with "with" because it does not implement __aenter__
Object of type "AsyncTransaction" cannot be used with "with" because it does not implement __aexit__

I believe that it is because AsyncTransaction's __aenter__ and __aexit__ are wrapped with functools.wraps(AsyncTransactionBase._enter) and functools.wraps(AsyncTransactionBase._exit) respectively

My Environment

Python Version: 3.11
Driver Version: 5.14
Operating System: macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions