* Add Protocol and runtime to typing_extensions
* Use private type variable
* Fix typo
* Bound type variable for runtime to only class objects
* Conform to version check specification
In Python 3 (but not Python 2), `object().__dir__()` works and returns a list of strings.
This is relevant when implementing a custom `__dir__` that invokes `super().__dir__()`.
Also change multiprocessing.Queue's put and get timeout arguments to
allow None.
This fixes a problem with logging.handlers.QueueHandler and
QueueListener not accepting a multiprocessing.Queue as the queue
argument.
Declaring the Queue now needs to note what it will be used for. eg.
q = multiprocessing.Queue() # type: multiprocessing.Queue[List[Any]]
E.g. it's legal to call traceback.format_exception(None, None, None). In
particular, this change makes the following idiom type-check:
import traceback
import sys
exc_type, exc_value, exc_traceback = sys.exc_info()
traceback.format_exception(exc_type, exc_value, exc_traceback)
After mypy [started hiding](https://github.com/python/mypy/pull/3706) imported names in stubs unless `from ... import ...` is used, we found an error with stubs of ast module.
It looks like ast module should re-export everything in `_ast` and according to PEP 484, it can do that by doing `from _ast import *`, so this is what this PR does.
This commit disables following flake8 errors:
* F403: `‘from module import *’ used; unable to detect undefined names`
* F405: `name may be undefined, or defined from star imports: module`
We don't need to worry about undefined names since running mypy_test.py
should detect such undefined names.
* Added stub for sre_parse(py3)
* Fixed return type of SubPattern.__getitem__
* Typo
* Fix for issue related to error class
* Added stub for sre_constants(py3)
* Added missing import
It is currently required to shut up mypy when run with `--strict`
or `--disallow-subclassing-any`. The `Any` base class is currently
the only way to allow passing an instance of `Mock` to functions
expecting other classes (as is Mock's purpose).
These stubs are identical in Python 2 and 3, but I believe they
should not be merged, because there are numerous other modules
in the encodings package, and some only exist in some Python
versions. I don't think we can support that in the 2and3
directory.