Closed rwe closed 1 year ago
This gives Fsm properly contravariant constructor types, so that the inputs can be general Iterable[str] but read-only types are exposed.
Fsm
Iterable[str]
It then types all of the methods, so that it passes mypy --strict greenery/fsm{,_test}.py.
mypy --strict greenery/fsm{,_test}.py
There are a couple minor fixes, as well:
copy()
self
frozenset(…).copy()
__eq__
a == "x"
AttributeError
This gives
Fsm
properly contravariant constructor types, so that the inputs can be generalIterable[str]
but read-only types are exposed.It then types all of the methods, so that it passes
mypy --strict greenery/fsm{,_test}.py
.There are a couple minor fixes, as well:
copy()
returnsself
, asfrozenset(…).copy()
does.__eq__
(e.g.a == "x"
) no longer throwsAttributeError
when compared to a different type.