Ivan Levkivskyi
135c6a56e5
bpo-37049: PEP 589: Add TypedDict to typing module (GH-13573)
...
The implementation is straightforward and essentially is just copied from `typing_extensions`.
2019-05-26 09:39:24 +01:00
Ivan Levkivskyi
b891c465bb
bpo-37046: PEP 586: Add Literal to typing module ( #13572 )
...
The implementation is straightforward and essentially is just copied from `typing_extensions`.
2019-05-26 09:37:48 +01:00
Ivan Levkivskyi
f367242d10
bpo-37045: PEP 591: Add final qualifiers to typing module (GH-13571)
...
The implementation is straightforward, it just mimics `ClassVar` (since the latter is also a name/access qualifier, not really a type). Also it is essentially copied from `typing_extensions`.
2019-05-26 09:37:07 +01:00
Paul Dagnelie
4c7a46eb3c
bpo-36972: Add SupportsIndex (GH-13448)
...
In order to support typing checks calling hex(), oct() and bin() on user-defined classes, a SupportIndex protocol is required. The ability to check these at runtime would be good to add for completeness sake. This is pretty much just a copy of SupportsInt with the names tweaked.
2019-05-22 15:23:01 +01:00
Andrew Svetlov
68b34a7204
bpo-36921: Deprecate @coroutine for sake of async def (GH-13346)
...
The second attempt. Now deprecate `@coroutine` only, keep `yield from fut` as is.
https://bugs.python.org/issue36921
2019-05-16 07:52:10 -07:00
Ismo Toijala
68b56d02ef
bpo-35341: Add generic version of OrderedDict to typing (GH-10850)
2018-12-02 15:53:14 +00:00
Serhiy Storchaka
961360923e
bpo-34181: Fix running Lib/test/test_typing.py as a script. (GH-8380)
2018-07-21 22:46:26 +03:00
Ivan Levkivskyi
f65e31fee3
bpo-28556: Don't simplify unions at runtime (GH-6841)
2018-05-18 16:00:38 -07:00
Nina Zakharenko
2d2d3b170b
Fix ClassVar as string fails when getting type hints (GH-6824)
2018-05-16 12:27:03 -04:00
Ivan Levkivskyi
b551e9f0ff
Fix a bug in Generic.__new__ (GH-6758)
2018-05-10 23:10:10 -04:00
Ivan Levkivskyi
43d12a6bd8
bpo-28556: Minor fixes for typing module (GH-6732)
...
This also fixes https://bugs.python.org/issue33420
2018-05-09 02:23:46 +01:00
Ivan Levkivskyi
2a363d2930
bpo-32873: Remove a name hack for generic aliases in typing module (GH-6376)
...
This removes a hack and replaces it with a proper
mapping {'list': 'List', 'dict': 'Dict', ...}.
2018-04-05 01:25:15 +01:00
Ivan Levkivskyi
ee566fe526
Call super in Generic.__init_subclass__ ( #6356 )
2018-04-04 17:00:15 +01:00
Ivan Levkivskyi
834940375a
bpo-32873: Treat type variables and special typing forms as immutable by copy and pickle (GH-6216)
...
This also fixes python/typing#512
This also fixes python/typing#511
As was discussed in both issues, some typing forms deserve to be treated
as immutable by copy and pickle modules, so that:
* copy(X) is X
* deepcopy(X) is X
* loads(dumps(X)) is X # pickled by reference
This PR adds such behaviour to:
* Type variables
* Special forms like Union, Any, ClassVar
* Unsubscripted generic aliases to containers like List, Mapping, Iterable
This not only resolves inconsistencies mentioned in the issues, but also
improves backwards compatibility with previous versions of Python
(including 3.6).
Note that this requires some dances with __module__ for type variables
(similar to NamedTuple) because the class TypeVar itself is define in typing,
while type variables should get module where they were defined.
https://bugs.python.org/issue32873
2018-03-26 23:01:12 +01:00
Ivan Levkivskyi
03e3c340a0
bpo-31333: Re-implement ABCMeta in C ( #5273 )
...
This adds C versions of methods used by ABCMeta that
improve performance of various ABC operations.
2018-02-18 12:41:58 +00:00
Ivan Levkivskyi
d911e40e78
bpo-32226: PEP 560: improve typing module ( #4906 )
...
This PR re-designs the internal typing API using the new PEP 560 features.
However, there are only few minor changes in the public API.
2018-01-20 11:23:59 +00:00
Ivan Levkivskyi
29bc193210
[bpo-28556] Minor fixes for typing module ( #4710 )
2017-12-04 21:43:58 -05:00
Éric Araujo
03b9537dc5
bpo-31567: more decorator markup fixes in docs (GH-3959) ( #3966 )
2017-10-12 12:28:55 -04:00
Łukasz Langa
f350a268a7
bpo-28556: typing.get_type_hints: better globalns for classes and modules ( #3582 )
...
This makes the default behavior (without specifying `globalns` manually) more
predictable for users, finds the right globalns automatically.
Implementation for classes assumes has a `__module__` attribute and that module
is present in `sys.modules`. It does this recursively for all bases in the
MRO. For modules, the implementation just uses their `__dict__` directly.
This is backwards compatible, will just raise fewer exceptions in naive user
code.
Originally implemented and reviewed at https://github.com/python/typing/pull/470 .
2017-09-14 14:33:00 -04:00
Ivan Levkivskyi
65bc62052f
bpo-28556: Minor updates to typing module ( #3550 )
...
* Copy changes to typing from upstream repo
* Add NEWS entry
2017-09-13 19:25:15 -04:00
Ivan Levkivskyi
29fda8db16
bpo-28556: Updates to typing module ( #2076 )
...
This PR contains two updates to typing module:
- Support ContextManager on all versions (original PR by Jelle Zijlstra).
- Add generic AsyncContextManager.
2017-06-10 12:57:56 -07:00
Ivan Levkivskyi
f06e0218ef
bpo-28556: Routine updates to typing ( #1366 )
...
- Add NoReturn type
- Use WrapperDescriptorType (original PR by Jim Fasarakis-Hilliard)
- Minor bug-fixes
2017-05-02 10:14:07 -07:00
Serhiy Storchaka
2e576f5aec
bpo-30144: Import collections ABC from collections.abc rather than collections. ( #1263 )
2017-04-24 09:05:00 +03:00
Ivan Levkivskyi
365cb5bb90
bpo-28556: Fix regression that sneaked into recent typing updates (GH-270)
2017-02-24 09:28:26 -08:00
Ivan Levkivskyi
abb3b8ad94
Update to typing: treat subscripted generics as proxies ( #265 )
2017-02-23 19:03:28 -08:00
Ivan Levkivskyi
b692dc8475
bpo-28556: Various updates to typing ( #28 )
...
various updates from upstream python/typing repo:
- Added typing.Counter and typing.ChainMap generics
- More flexible typing.NamedTuple
- Improved generic ABC caching
- More tests
- Bugfixes
- Other updates
* Add Misc/NEWS entry
* Add issue number
2017-02-13 13:50:14 -08:00
Guido van Rossum
95919c096c
Issue #28556 : Allow defining methods in NamedTuple class syntax ( #362 )
2017-01-22 17:47:20 -08:00
Guido van Rossum
d7adfe129c
Issue #28556 : various style fixes for typing.py
2017-01-22 17:43:53 -08:00
Guido van Rossum
e9ed560fce
Issue #29198 : add AsyncGenerator (Jelle Zijlstra)
2017-01-18 13:10:31 -08:00
Guido van Rossum
3c268be885
Issue #28556 : allow default values in class form of NamedTuple -- Jelle Zijlstra
2017-01-18 08:03:50 -08:00
Guido van Rossum
83ec302e52
Issue #28556 : merge 5 more typing changes from upstream ( #340 , #344 , #348 , #349 , #350 )
2017-01-17 20:43:28 -08:00
Raymond Hettinger
80490525e0
Issue #29011 : Fix an important omission by adding Deque to the typing module.
2017-01-16 22:42:37 -08:00
Guido van Rossum
61f0a0261f
Issue #28790 : Fix error when using Generic and __slots__ (Ivan L)
2016-11-29 09:46:21 -08:00
Guido van Rossum
ca4b252fba
Issue #28556 : two more small upstream changes by Ivan Levkivskyi ( #329 , #330 )
2016-11-19 10:32:41 -08:00
Guido van Rossum
2f84144235
Issue #28556 : Allow keyword syntax for NamedTuple (Ivan Levkivskyi) (upstream #321 )
2016-11-15 09:48:06 -08:00
Guido van Rossum
f9099de894
Issue #28649 : fix-typing-test-v2.diff
2016-11-09 13:18:59 -08:00
Guido van Rossum
991d14fee1
Issue #28556 : More typing.py updates from upstream.
2016-11-09 13:12:51 -08:00
Guido van Rossum
62fe1bb983
Issue #28556 : updates to typing.py (add Coroutine, prohibit Generic[T]())
2016-10-29 16:05:26 -07:00
Guido van Rossum
b7dedc89f1
Issue #28556 : updates to typing.py (fix copy, deepcopy, pickle)
2016-10-29 12:44:29 -07:00
Guido van Rossum
5fc25a873c
Issue #28556 : updates to typing.py
2016-10-29 08:54:56 -07:00
Guido van Rossum
3b557991d4
Two minor typing.py fixes (upstream #305 )
2016-10-21 17:30:29 -07:00
Guido van Rossum
ac353dfa14
Issue #28482 : Skip a few test_typing tests if asyncio unavailable
2016-10-21 16:12:17 -07:00
Guido van Rossum
7ef22d6b96
Sync typing.py from upstream
2016-10-21 14:27:58 -07:00
Guido van Rossum
e259267e52
Merge further typing.py changes from upstream.
2016-10-08 20:27:22 -07:00
Guido van Rossum
b47c9d29d7
More updates from upstream typing.py
2016-10-03 08:40:50 -07:00
Guido van Rossum
4cefe74aef
Update typing.py and test_typing.py from upstream ( https://github.com/python/typing )
2016-09-27 15:20:12 -07:00
Guido van Rossum
0a6976da10
Issue #28079 : Update typing and test typing from python/typing repo.
...
Ivan Levkivskyi (3.5 version)
2016-09-11 15:34:56 -07:00
Guido van Rossum
efa798d1ba
A new version of typing.py from https://github.com/python/typing .
2016-08-23 11:01:50 -07:00
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
eb9aca3c07
Added Type[C] implementation to typing.py.
2016-05-24 16:38:22 -07:00