New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected keyword argument #40
Comments
Duplicate of #5 (I have this working locally, but it requires more polish before publishing.) |
Is there a workaround ? from typing import Any
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base() # type: Any
class User(Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
name = Column(String)
class Address(Base):
__tablename__ = 'addresses'
id = Column(Integer, primary_key=True)
name = Column(String)
def f() -> Address:
user = User(name="xx")
return user # mypy should log an error here but doesn't |
@ilevkivskyi Can I have ave some feedback on this if you have some time ? |
There is no way to have no false positives and no false negatives before the plugin is ready. You can use |
But then I have a ton of ""error: Unexpected keyword argument "name" for "User"" errors. It would require me an hour of "type: ignore" to silence them ^^. |
@as_declarative
class Base:
def __init__(self, *args, **kwargs) -> None: ... |
Hello,
With the latest release of mypy and the master branch of sqlalchemy-stubs, this code causes mypy to raise a "error: Unexpected keyword argument "name" for "User""
Is there smth I can do to avoid these errors ?
The text was updated successfully, but these errors were encountered: