beanie icon indicating copy to clipboard operation
beanie copied to clipboard

[BUG] Mypy Strict fails with call to untyped function "Set" in typed context [no-untyped-call] error

Open AndrewMHenry opened this issue 8 months ago • 2 comments

Describe the bug This is the same basic bug as #836, except it applies to BaseUpdateGeneralOperator instead of BaseFindComparisonOperator.

To Reproduce Running mypy in strict mode produces error: Call to untyped function "Set" in typed context [no-untyped-call] for the call to Set on line 10 of the following Python code:

from beanie import Document
from beanie.odm.operators.update.general import Set


class Sample(Document):
    one: int


def main() -> None:
    Set({Sample.one: 2})

Expected behavior There should be no mypy errors.

Additional context Pull request #925 will fix issue #836, but it will not fix this one; fixing this issue would require also type-hinting the return value of BaseUpdateGeneralOperator.__init__(). It might be worth diving into the code to see if there are other similar instances, although I don't know of any right now.

Thanks!

AndrewMHenry avatar Jun 10 '24 17:06 AndrewMHenry