Also fix signature of IO.seek, IO.truncate, IO.write, and MutableMapping.update
Fixes#1016
Note: I couldn't put typing.pyi in 2and3 because of an import cycle when adding `import sys` to 2/typing.pyi
* add compileall stubs to 3 and add types to the ones in 2
Didn't merge the stubs because all functions have additional parameters since 3.2,
so there would be no shared code between 2 and 3.
* add comment
- Add sys.version_info checks (mypy now supports them)
- Went over Python 3 docs and corrected a few things
- Reexport things that are imported from opcode
CONTRIBUTING.md says to prefer ... Not the most impactful change but fixing
these will allow us to lint for it in the future and get a consistent style.
The stubs for `unittest.TestCase.assertCountEqual()` specify the parameters are Sequences; in fact the method works fine with Iterables, as the first thing the method does is convert them to lists. [1] The docs do say sequences, but it appears there is no reason they cannot be Iterables.
[1]: https://github.com/python/cpython/blob/master/Lib/unittest/case.py#L1156
* Complete the tokenize module type hints
* Add missing import for Optional
* Use a 3.5-style named tuple, untokenize speaks with forked tongue so use Any
* Use explicit types for fields
"> (3,)" works but looks like the code is checking for Python 4.
"<= (3, 5)" was intended to check for versions up to and including 3.5, and probably works that
way in current type checkers. However, sys.version_info is actually a 5-tuple that is greater
than (3, 5), so a hypothetical type checker that uses the full version info would interpret
this check incorrectly.
This ensures that all version_info comparisons use <, >=, ==, or !=.
Closes#953.
I reviewed the documentation at https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.AbstractEventLoop and added missing methods and missing @coroutine decorators.
I ran mypy on the sample file from the issue report to confirm that mypy handles the combination of @abstractmethod and @coroutine correctly.
Also fixed a number of types in this file that are annotated as Any but could be given more precise types (e.g., sockets and protocol factories).
Both mypy and pytype only use the major and minor version in type checking. Using
checks like "sys.version_info >= (3, 4, 4)" won't actually work properly for
people type checking their code using version 3.4, because (3, 4) >= (3, 4, 4) will
always be false (at least in mypy's approach; not sure if pytype is different).