-
Hi, MyPy is raising the following exceptions:
In my code, I'm subclassing in the most regular way, e.g for Screen :
And get the previous exceptions. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I would expect mypy to perhaps give a warning about inheriting from If you're not intending to return a result from your modal screen you can change the code you show above to be like this: class ModalScreen(Screen[None]):
... As a slight aside to this, you might want to note that More generally though, I'm not clear on why you'd be seeing the warnings you're showing there. I'm running Do you think you could show a simple stand-alone bit of code that demonstrates these warnings, and also give details of your |
Beta Was this translation helpful? Give feedback.
I would expect mypy to perhaps give a warning about inheriting from
Screen
with more recent versions of Textual as there is a new feature -- still to be properly documented -- for typing a screen and being able to return a result from a screen when it's dismissed. See #2321 for more details on that.If you're not intending to return a result from your modal screen you can change the code you show above to be like this:
As a slight aside to this, you might want to note that
ModalScreen
is now a type in Textual.More generally though, I'm not clear on why you'd be seeing the warnings you're showing there. I'm running
mypy
v1.2.0 here and testing it o…