qntm / greenery

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

parse.py + parse_test.py type fixes #90

Closed rwe closed 1 year ago

rwe commented 1 year ago

This makes the result types consistent in matcher helpers in parse.py, defines a generic MatchResult[…] type, and annotates the functions there.

This is sufficient to pass mypy --strict greenery/parse{,_test}.py.

One change was required in rxelems, to avoid untyped-call errors due to missing annotations on the Conc and Pattern constructors: that change is also included effectively in #89 and should merge cleanly.