Commit Graph

8 Commits

Author SHA1 Message Date
Dakkaron
59d64f4e2b re methods' pattern-parameters don't affect the return value anymore (#281)
Note that this is a 2.7-only change (in Python 3, the pattern type must match the other parameter and the result).
2016-06-09 09:54:59 -07:00
Scott G. Ainsworth
82b9baed3b Changed all regular expression findall() to return list[Any]. Findall() can return both list[AnyStr] and list[Tuple[AnyStr, AnyStr]]. (#269) 2016-06-05 17:50:12 -07:00
David Fisher
fb96ee8e50 Revert "replace re patterns AnyStr with Union[str, unicode]"
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.
2016-06-03 17:41:01 -07:00
Oren Leaffer
ba2c8d95ec replace re patterns AnyStr with Union[str, unicode] 2016-06-02 17:53:39 -07:00
Guido van Rossum
3e37029bfe Almost all re functions take a compiled pattern. (Even re.compile()!) (#203)
* 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.
2016-05-16 11:25:59 -07:00
Tim Abbott
21c90d52b9 Fix re module constant stubs for 2.7.
ASCII doesn't exist in 2.7, but UNICODE and TEMPLATE do.
2016-01-25 12:32:31 -08:00
Matthias Kramm
94c9ce8fd0 Consistently use '= ...' for optional parameters. 2015-11-09 13:55:02 -08:00
Matthias Kramm
337abed05a add (overwrite with) mypy stubs, if available 2015-09-30 09:59:44 -07:00