qntm / greenery

Regular expression manipulation library
http://qntm.org/greenery
MIT License
331 stars 40 forks source link

fsm: immutability and fixed types #84

Closed rwe closed 1 year ago

rwe commented 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.

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: