class Foo(DeclarativeBase):
a = Column(String(128), nullable=False, index=True)
bar = relationship(Something, foreign_keys=[a], primaryjoin="Foo.doi==Something.doi")
b = Foo(a="a")
if b.bar is None: # unreachable code
...
print(b.bar) # None
Mypy says that Foo().bar cannot be None, but it clearly can be.
Mypy says that
Foo().bar
cannot beNone
, but it clearly can be.