-
Notifications
You must be signed in to change notification settings - Fork 99
Closed
Description
There are several things typed as X in current stubs while in reality the type is Optional[X]. One such thing (probably one of the most important) is Column. Just making the inferred type Optional would cause loads of false positives.
A possible solution is to use nullable keyword to distinguish these (and probably primary_key), for example:
class User(Base):
id = Column(Integer(), primary_key=True)
name = Column(String(), nullable=False)
nickname = Column(String())
user: User
revreal_type(user.id) # Revealed type is 'int'
reveal_type(user.name) # Revealed type is 'str'
reveal_type(user.name) # Revealed type is 'Optional[str]'cc @jhance who might be interested in this.