diff options
author | Daniel Schadt <kingdread@gmx.de> | 2021-08-21 22:59:52 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2021-08-21 22:59:52 +0200 |
commit | f39ec7d2f4b609c0968767590eeb864a48b41401 (patch) | |
tree | 312956876d49206c8f22252cc5ac8a80385751b2 /wikimini.py | |
parent | f384001e0818968306917566c2007c21a7a13613 (diff) | |
download | wikimini-f39ec7d2f4b609c0968767590eeb864a48b41401.tar.gz wikimini-f39ec7d2f4b609c0968767590eeb864a48b41401.tar.bz2 wikimini-f39ec7d2f4b609c0968767590eeb864a48b41401.zip |
More type fixes
This makes mypy happier about how we use .extend, since it doesn't know
about the fact that all list items should be either Node or Block, not
mixed.
In the first case, we can fix it by using .append(current[0]), as mypy
will see the isinstance() above and ascribe the correct type.
In the second case, we use the cast no-op function to assign the correct
type. That should be cheap and makes mypy happy, even if it doesn't give
us any runtime checks (which is fine, this is Python after all).
In the third case, we're iterating over every element anyway, so we can
throw in an assert to make sure the list item has the correct type. This
also helps in catching some bugs, in case .convert() returns a mixed
list (but only if the first item happens to be a Node).
Diffstat (limited to 'wikimini.py')
0 files changed, 0 insertions, 0 deletions