Open rchl opened 1 year ago
Same issue I've just noticed in PhantomSet.update
method. It's def update(self, phantoms: Iterator[Phantom]):
, should be def update(self, phantoms: Iterable[Phantom]):
Should be a a quick fix.
BTW. It's not only the add_all
method. Also update
:
And while at it, this also jumps out as wrong:
(Though if we'd apply the strict Pyright checking then there would be much more to report...)
Fixed in build 4157.
The type of region
in Selection.add_all
was updated to Iterator[Region | Point]
but as I've mentioned in this issue, it's not an Iterator
but Iterable
. A plain list is not compatible with Iterator
type so you can't pass it to add_all
which is clearly supported.
And also the same issue applies to: PhantomSet.update
.
And the [Phantom]
in self.phantoms: [Phantom] = []
is an invalid annotation. Should be List[Phantom]
. Unless it is allowed in some latest Python versions but still the more compatible way would be using List
.
Description of the bug
Selection.add_all
can also take aPoint
since it callsSelection.add
which takes a point.And also,
Iterator
should beIterable
sinceList
is not a subset ofIterator
due to missing the__next__
implementation so passing plain list toadd_all
will show a type error.I believe the type should thus be
Iterable[Region | Point]
Sublime Text build number
4147
Operating system & version
macOS