If I comment out that line, the error goes away for .save(), .update(), .insert().
I don't know enough about what this code is doing to know how to fix it, but hopefully this will help identify the root of the issue.
(Note that commenting that one line does not fix .save_update(), so I assume there's also other places where a similar thing is happening)
Expected behavior
No typing errors
Additional context
Pylance v2024.2.2, Type Checking Mode: 'basic'
Error also happens with the previous Pylance version, v2023.12.1.
Describe the bug
I use VSCode with Pylance. Every time I use
.save()
,.insert()
,.update()
or.save_changes()
I get this Pylance error:Screenshot, showing the error on three of the mentioned methods:
To Reproduce
This is quite frustrating because I currently have to litter my code with
# type: ignore
messages, which risks hiding real issues.Problem source
I've done some digging, and the error on
.save()
,.update()
,.insert()
seems to be caused by the call tofunctools.wraps()
:It's this line in beanie/odm/actions.py:wrap_with_actions.
If I comment out that line, the error goes away for
.save()
,.update()
,.insert()
. I don't know enough about what this code is doing to know how to fix it, but hopefully this will help identify the root of the issue.(Note that commenting that one line does not fix
.save_update()
, so I assume there's also other places where a similar thing is happening)Expected behavior No typing errors
Additional context
Thanks in advance