beanie
beanie copied to clipboard
[BUG] pylance for set inc and delete method (function
Describe the bug
So im trying update a document using set (for a boolean and i have this error pylance : Unable to assign argument of type “dict[bool, bool]” to parameter “expression” of type “Dict[ExpressionField | str, Any]” in the “set” function Unable to assign type 'bool' to type 'ExpressionField | str » “bool” is not compatible with “ExpressionField” “bool” is not compatible with “str”PylancereportGeneralTypeIssues (variable) published: bool
im trying increase an integer using the inc method and have this error pylance : Unable to assign argument of type “dict[int, int]” to parameter “expression” of type “Dict[ExpressionField | str, Any]” in the “inc” function Cannot assign type 'int' to type 'ExpressionField | str » “int” is not compatible with “ExpressionField” “int” is not compatible with “str” Pylance
error on using delete method Missing argument for parameter "self"PylancereportGeneralTypeIssues (method) delete: _Wrapped[..., Unknown, (self: Unknown, *args: Unknown, skip_actions: List[ActionDirections | str] | None = None, **kwargs: Unknown), Coroutine[Any, Any, Unknown ]]
To Reproduce
class Character(Document):
published: bool
age: int
class Settings:
name = "Characters"
test = await Character.find_one()
if test:
await test.set({Character.published: True})
await test.inc({Character.age:1})
await test.delete()
the function itself do the correct things, its just the pylance errors (i tried my best to explain it im still new on doing github issues)
Hi! Thank you for the catch. I'll check and fix it this/next week.
class DocPlayer(Document):
money: int
await DocPlayer.find_all().sort(-DocPlayer.money).to_list()
Cannot assign argument of type "int" to parameter "args" of type "str | Tuple[str, SortDirection] | List[Tuple[str, SortDirection]] | None” in “sort” function Cannot assign type 'int' to type 'str | Tuple[str, SortDirection] | List[Tuple[str, SortDirection]] | None » “int” is not compatible with “str” “int” is not compatible with “Tuple[str, SortDirection]” “int” is not compatible with “List[Tuple[str, SortDirection]]” Type cannot be assigned to type 'None'
another one that is a bit annoying on trying to sort by highest to lowest
Hi, Sorry for the delay. I'll try to pick up typing bugs soon. But I have to fix runtime bugs firstly.