mongoengine
mongoengine copied to clipboard
Add autocompletion for instanciation
On Visual Studio Code, there is no useful hint on the parameters and the type for the instanciation of the object.
Example:
from mongoengine import Document, StringField
class User(Document):
name = StringField(required=True)
surname = StringField(required=False)
user = User(
HINT: (...) -> User
To have useful hint, I am doing that on my project: Example:
from typing import Optional
from mongoengine import Document, StringField
class User(Document):
name = StringField(required=True)
surname = StringField(required=False)
def __init__(self, name: str, surname: Optional[str], *args, **kwargs):
super().__init__(name=name, surname=surname, *args, **kwargs)
user = User(
HINT: (name: str, surname: str | None, ...) -> User
This is really practical but I have to do a lot of duplication of code, is there a way to propose the attributes "automatically" ? can I help you do that ?