Open
Description
Following code fails on mypy and pyright checks:
from peewee import CharField, Model, PrimaryKeyField
class Foo(Model):
id = PrimaryKeyField()
name = CharField()
def find_foo_by_name(name: str) -> Foo:
return Foo.get(Foo.name.in_(name)) # <- mypy error here
find_foo_by_name('foo bar')
mypy:
$ poetry run mypy main.py
main.py:10: error: Too few arguments [call-arg]
main.py:10: note: "in_" is considered instance variable, to make it class variable use ClassVar[...]
main.py:10: error: Argument 1 has incompatible type "str"; expected "CharField" [arg-type]
Found 2 errors in 1 file (checked 1 source file)
pyright:
$ poetry run pyright main.py
/tmp/a/main.py
/tmp/a/main.py:10:20 - error: Expected 1 more positional argument (reportCallIssue)
1 error, 0 warnings, 0 informations
There is a PR which fixes the issue: #14275
Metadata
Metadata
Assignees
Labels
No labels