This reverts commit ba2c8d95ec.
This commit introduced some bugs (it used Pattern[Union[str, unicode]]
when it would need to be Union[Pattern[str], Pattern[unicode]]), and
- on further discussion - it's unclear if we want to allow this
additional flexibility. I'm reverting this diff for now, but we'll
revisit this after deciding on the upcoming proposal about how implicit
bytes/unicode conversions should be handled when typing Python 2.
* Almost all re functions take a compiled pattern. (Even re.compile()!)
Fixes#188
Note: I'm using AnyStr so that the type of string used for pattern and
for the rest of the arguments must match. This is not 100% correct,
since Python 2 sometimes allows mixed types. But sometimes it
doesn't, depending on the values (e.g. non-ASCII bytes), and Python 3
always insists on matching, so I think this is actually a good idea.
* Same treatment for stdlib/3/re.pyi.