* Partially refine numbers.pyi
This commit refines numbers.pyi. More specifically, it...
- Adds in explicit type annotations where it's obvious how to do
so (leaving more non-obvious type signatures alone).
- Adds in missing '@abstractmethod' decorators
- Combines together the Python 2 and Python 3 versions of numbers.pyi.
* Merges Python 2 and Python 3 numbers.pyi
This commit removes the old `stdlib/2.7/numbers.pyi` file and moves the
previously-committed `stdlib/3/numbers.pyi` to the shared `2and3`
directory.
* Modify comment at top of numbers.pyi
Since the stubs are no longer identical to what stubgen creates, the
comment should also probably be changed.
This is necessary, because exception formatting functions like `traceback.format_exception()` expect to get `Type[BaseException]`, but sys.excepthook only provided `type`
* Make Mapping covariant.
Fixes#510.
This requires a `# type: ignore` on `__getitem__` and `get` because
mypy complains about covariant parameters.
FWIW typing.py needs to be changed too. (It was covariant in the
value but invariant in the key -- typeshed was invariant in both.)
* Delete outdated comment.
* Backpeddle a bit -- Mapping key type should not be covariant.
In Python, it's possible to use the `next` builtin method on file
objects produced by `open`. This change modifies `typing.IO` so this
usage will successfully typecheck.
* Stub: asyncore.pyi
I can't really test this stub since I don't use this module. I believe it's not far from the real thing.
It's based on the source code and not on the documentation.
https://hg.python.org/cpython/file/default/Lib/asyncore.py
* Option ->Optional
* add hint to count, remove addr
* make read/write explicit functions
* add synchat.pyi, move to 2and3
* change sys.version_info test
* try reversing the syntax
I went through each method in the source and verified the inputs it accepts and outputs it gives. I also redefined a few methods on the `Path` class so that MyPy knows they return `Path` instead of `PurePath`. This is really just a temporary workaround until https://github.com/python/mypy/issues/1212 is fixed, but greatly improves the process of working with the `pathlib` module and is therefore likely worth the duplication.
Adds several attributes which were missing from the Logger types,
including "name", "level", and "parent". Because the type of "parent"
is a union of Logger and PlaceHolder, we also define types for
PlaceHolder and all of it's methods.