Commit Graph

15 Commits

Author SHA1 Message Date
Guido van Rossum 91185fe028 Sync typing.py with upstream.
(Upstream is https://github.com/python/typing)

- Add TYPE_CHECKING (false at runtime, true in type checkers) (upstream #230).
- Avoid error on Union[xml.etree.cElementTree.Element, str] (upstream #229).
- Repr of Tuple[()] should be 'Tuple[()]' (upstream #231).
- Add NewType() (upstream #189).
2016-06-08 11:19:11 -07:00
Guido van Rossum b22c708989 Comment/docstring tweaks for typing.py. 2016-05-26 09:56:19 -07:00
Guido van Rossum eb9aca3c07 Added Type[C] implementation to typing.py. 2016-05-24 16:38:22 -07:00
Guido van Rossum 1cea70f08c Fix #27014 -- infinite recursion using typing.py. 2016-05-18 08:35:00 -07:00
Guido van Rossum 5abcbb3ee5 typing.py: Consider ellipsis in TupleMeta.__eq__. By Kalle Tuure. github.com/python/typing/pull/201. 2016-04-18 07:37:41 -07:00
Brett Cannon f3ad042bfb Issue #25609: Backport typing.ContextManager.
This has no semantic impact as the class is guarded with a hasattr()
check; this is being done to keep typing.py in sync between Python 3.5
and 3.6 as requested by Guido.
2016-04-15 10:51:30 -07:00
Guido van Rossum 0e0563ca2c Add Text=str. Make ItemsView derive from AbstractSet, not Set (which is the concrete set). 2016-04-05 14:54:25 -07:00
Guido van Rossum bd5b9a0742 Many changes from the upstream repo (https://github.com/python/typing).
This syncs to rev 7b43ada77821d23e55e3a4b35f6055a59b9e1ad7 there.

Summary:

- Add typing.DefaultDict (as a generic variant of collections.defaultdict).

- Use collections.Reversible if it exists (only relevant for Python 3.6).

- Revamped generic class behavior to conform to updated PEP 484.

- Improve speed of Generic.__new__.

- Make sure __init__ is called for new Generic instances. Fix issue #26391.

- Refactor async support to be compatible with 3.2, 3.3, 3.4.

- Remove 'io' and 're' from __all__ (they still exist, just not
  included by "import *"). Fix issue #26234.

- Change @overload -- you can now use it outside stubs (you still
  cannot call the decorated function though).
2016-04-05 08:28:52 -07:00
Guido van Rossum f17c20076c Add Awaitable, AsyncIterable, AsyncIterator to typing.py. 2015-12-03 17:31:24 -08:00
Guido van Rossum 557d1eb0f3 Issue #25665: Make NamedTuple picklable. 2015-11-19 08:16:31 -08:00
Guido van Rossum bb7c57c6cd Issue #25472: In B[<type>], insert B in front of __bases__, to make the __dict__ descriptor work. 2015-11-18 21:12:58 -08:00
Guido van Rossum ca636eac88 Issue #25390: typing: Don't crash on Union[str, Pattern]. 2015-10-19 14:55:47 -07:00
Guido van Rossum 1b66910537 Fix issue #24635. 2015-09-04 12:15:54 -07:00
Guido van Rossum d70fe639c1 Issue #23973: Update typing.py from GitHub repo. 2015-08-05 12:11:06 +02:00
Guido van Rossum 46dbb7d103 Preliminary typing.py, anticipating provisional acceptance of PEP 484.
There area bunch of TODOs here, but the biggest (not mentioned in the
file) is that I'm going to take out __instancecheck__ and
__subclasscheck__.  However my personal schedule is such that I
probably won't have time for these before Larry tags beta 1.  But I
will try -- this commit is mostly to make sure that typing.py doesn't
completely miss the train.

PS. I'm tracking issues at https://github.com/ambv/typehinting/issues.
2015-05-22 10:14:11 -07:00