Commit Graph

446 Commits

Author SHA1 Message Date
Guido van Rossum a84d7ada69 Bump version to 3.6.2 and use setuptools instead of distutils (#453)
Also update metadata to remove compatibility with 3.5+, and add Ivan
to the list of authors.
2017-08-08 10:35:32 +02:00
Michael Lee 59c0987a02 Add typing extensions (#443)
This pull request adds a 'typing_exensions' subproject to 'typing'. The
'typing_extensions' module backports any new additions to 'typing'
for Python 3.5+ users who are using older versions of 'typing' that were
bundled with their standard library (and so can't update to the latest
versions). As well, it will contain new experimental features than could
eventually end up in 'typing'.

See https://github.com/python/typing/issues/435 for motivation and
additional context.
2017-07-20 17:17:25 +02:00
Ivan Levkivskyi 2b6932a85a Speed improvements for typing (#439)
* Inline _geqv and _gorg

* Fix typo

* Cut MROs in half

* Avoid recursion on _gorg

* Fix lint

* Fxi lint (for realz)

* Refactor erasure logic to make it clearer (and probably faster)

* Remove redundant check

* Remove unnecessary comment

* Backport first part to Python 2

* Backport second part to Python 2

* Keep only obvious speed-ups and drop more aggressive optiomizations

* Fix _Protocol on Python 2

* Address CR
2017-07-17 06:57:57 -07:00
Michael Lee b11fbed24d Remove Python 3.2 from .travis.yml (#444)
Our `setup.py` file explicitly throws an error when users try and
install typing for Python 3.0 through 3.2. In that case, it doesn't
seem like testing typing against Python 3.2 is worth it.
2017-06-27 12:03:16 +02:00
Ivan Levkivskyi eb96eb7414 Add gitter chat icon (#440)
This PR adds a gitter chat icon for the newly created python/typing room.
2017-06-12 11:53:55 -07:00
Ivan Levkivskyi 74bc3ee08f Add AsyncContextManager generic class (#438)
Asynchronous context managers are defined by PEP 492, but there is no corresponding generic abstract class in typing. This PR adds it for Python 3.5+.
2017-06-09 08:45:31 -07:00
Jelle Zijlstra 47e0860e53 add typing.ContextManager on all supported Python versions (#422)
So that there is a way to type hint for a context manager even on
language versions before 3.6.

This is just copied from contextlib.AbstractContextManager in 3.6.

Fixes #274
2017-05-06 10:01:53 -07:00
Ivan Levkivskyi d9e477ede4 Apply changes made by Serhiy in CPython repo (#419) 2017-04-30 22:02:26 +02:00
Ivan Levkivskyi 53679b1a04 Add missing classes to __all__ (#409) 2017-04-18 11:35:53 +02:00
Jim Fasarakis-Hilliard c86f9bfa14 Rename SlotWrapperType to WrapperDescriptorType (#408) 2017-04-18 10:33:01 +02:00
Ivan Levkivskyi ffb0caf685 Prohibit '_source' as a method name in NamedTuple (#407) 2017-03-30 15:01:04 -07:00
Łukasz Langa 7dfedb20a0 Add missing mod_generics_cache.py to MANIFEST.in (#406)
* Add missing mod_generics_cache.py to MANIFEST.in

* Don't duplicate lines
2017-03-27 20:08:09 +02:00
Ivan Levkivskyi 48082ad23e Add NoReturn type (#397)
* Add NoReturn type

* Simplify NoReturn checks
2017-03-27 12:21:10 +02:00
Łukasz Langa c5f842d102 Fix ReST syntax in README.rst 2017-03-26 19:04:39 -07:00
Łukasz Langa f264669254 Release 3.6.1, drop 3.2 support 2017-03-26 18:27:20 -07:00
Łukasz Langa eaf73ab938 Explain PyPI release workflow
Also, drop py32 from tox.ini since it cannot work anymore. Include py35 and
py36 instead.
2017-03-26 13:40:30 -07:00
Ivan Levkivskyi ad956f4291 Remove duplicate test in AnyTests (#398) 2017-03-04 23:57:29 +01:00
Matteo Bertini b185b8d310 Fix typo in NamedTuple docstring (#396)
Add missing open parenthesis
2017-03-04 09:08:50 +01:00
Ivan Levkivskyi 78fab13a1f Prevent ABC registry being wiped out by new __setattr__ (#394) 2017-02-24 09:26:09 +01:00
Ivan Levkivskyi 07fdb60c6a Treat subscripted generics as "proxies" for original class. (#393)
* Initial implementation (tests and PY2 port needed)

* Tests and PY2 backport

* Be more cooperative, use super()
2017-02-24 00:18:04 +01:00
Ivan Levkivskyi c53963f8e8 Fix name and imports for test module mod_generics_cache.py (#390)
* Fix name and imports for test module mod_generics_cache

* Fix lint
2017-02-11 12:06:22 +01:00
Ivan Levkivskyi 370a137a70 Add some tests based on coverage report: Part 2 (#375)
* Add more tests based on coverage report

* Fix lint on PY2

* Simplify PR to only tests and tiny code clean-up

* Remove _right_ code on PY2

* Re-run Travis
2017-02-10 20:34:01 +01:00
Ivan Levkivskyi 58c86ad81f Optimize ABC caches (#383)
* Optimize ABC negative cache for generics

* Add also positive cache and registry links

* Formatting

* Add ABC optimization to PY2

* Inline internal helper for more speed

* Fix negative cahce setters

* Fix negative cahce setters on PY2

* Make negative caches writable only for non-subscripted generics
2017-02-10 20:25:56 +01:00
Jelle Zijlstra d6390f3171 Add typing.Counter and typing.ChainMap (#366)
* Add typing.Counter

Pretty much copied from deque.

* also add ChainMap

Only to the Python 3 version because ChainMap was added in 3.3.

* fix for 3.2

Apparently typing still supports 3.2

* fix flake8

* fix base class of Counter

* move counter below Dict

* clarify error message, add test

* allow instantiation

* fix reliance on type cache
2017-02-10 20:18:10 +01:00
Ivan Levkivskyi 33560c8ae7 Allow overriding some methods in NamedTuple (#370)
* Allow owerriding some methods in NamededTuple

* Fix lint

* Response to review comments (performance)
2017-02-10 20:16:42 +01:00
Ivan Levkivskyi 2d85d8c7b8 Compactify get_type_hints code (#388) 2017-02-10 19:40:24 +01:00
Manuel Krebber 440dcdee00 Make get_type_hints not throw an error on builtin methods (#368)
* Added support to get_type_hints for builtin methods like object.__init__ or object.__str__ etc.

* Fixed tabs vs spaces -.-

* Changed the type check for builtin functions/methods to use the new types in the types module.
2017-02-10 19:03:13 +01:00
Ivan Levkivskyi 1229efb63e Prepend bases on first subscription (#386)
* Prepend bases with _gorg on subscription

* Simplify code
2017-02-03 23:36:50 +01:00
Ivan Levkivskyi d149ce7212 Add some tests based on coverage report: Part 1 (#373)
* Add some tests based on coverage report

* Fix lint
2017-02-01 09:34:07 +01:00
Jelle Zijlstra 75380ac5a7 fix running tests directly in py2 (#382)
* fix running tests directly in py2

* use test_typing
2017-02-01 00:00:20 +01:00
Ivan Levkivskyi d1e18604fb Allow istantiation of Deque and DefaultDict (#381) 2017-01-31 12:50:58 +01:00
Ivan Levkivskyi 239b3a332f Clarify the role of mod.py files (#376) 2017-01-28 18:43:36 +01:00
Ivan Levkivskyi abfdf497fa Fix hash of GenericMeta classes (#371)
* Fix hash of GenericMeta classes

* Fix lint

* Fix for Python 3.2 repr()
2017-01-27 22:05:55 +01:00
Ivan Levkivskyi 27f6d630ac Fix deprecation warning in tests (#365) 2017-01-24 08:46:05 +01:00
Ivan Levkivskyi 961ebc67ee Raise AttributeError on name collision in NamedTuple (#364)
* Raise AttributeError on name collision in NamedTuple
2017-01-23 15:28:58 -08:00
Ivan Levkivskyi 6e337a8538 Allow defining methods in NamedTuple class syntax (#362)
* Allow defining methods in NamedTuple class syntax
2017-01-22 17:04:31 -08:00
Lukasz Langa a15575f78a Align continuations in tests 2017-01-20 12:32:57 -08:00
Lukasz Langa ff49655c47 Adopt 90-character long line checks
Rationale: closer to the PEP 8 mandated 79 for the standard library, while
requiring minimal changes to sources.
2017-01-20 12:26:58 -08:00
Lukasz Langa 1fbe5f0c20 Removed unused assignments in tests 2017-01-20 12:18:07 -08:00
Lukasz Langa 8a38e1ba0e Missing spaces after commas in tests 2017-01-20 12:15:41 -08:00
Lukasz Langa e9e8899986 Remove spurious space around argument defaults in tests 2017-01-20 12:13:16 -08:00
Lukasz Langa 3af51faad7 Remove unused names from tests 2017-01-20 12:11:28 -08:00
Lukasz Langa 5a2ab63e61 Fix type comment indentation in nested class 2017-01-20 12:06:52 -08:00
Lukasz Langa f5b2a0c86a Fix missing whitespace on module-level in tests 2017-01-20 12:04:48 -08:00
Łukasz Langa b71afa7657 Enable flake8 for test_*.py on Travis CI (#361)
For now this requires a test-specific config while I plow through the warnings
that are specific to tests.

To test this actually does something, I fixed F821 by putting the fake names to
make flake8 happy.  Hopefully you don't find this too terrible.  The other
choice was to disable "undefined names" warnings entirely.  I didn't want to do
that because I find them very useful.
2017-01-20 20:53:35 +01:00
Łukasz Langa 177d671ebe Update README.rst to clarify provisional status 2017-01-19 18:20:30 -08:00
Łukasz Langa 8d28131d46 Fix if statements with ambiguously indented bodies (#360)
Since this was related to the same lines in conditions, also fixed binary
operators on line beginnings.
2017-01-19 09:50:04 +01:00
Łukasz Langa 1830f2e68a Fix visual indent (#359) 2017-01-19 09:42:47 +01:00
Łukasz Langa 17e1b5b526 Use canonical "is None" checks instead of "== None" (#358) 2017-01-19 09:36:51 +01:00
Łukasz Langa 6590133f0e Remove unused `enumerate()` call (#357) 2017-01-19 09:36:29 +01:00