Reason: https://github.com/python/mypy/issues/328
* Revert "Make fromkeys() take an Iterable instead of a sequence. (#605)"
This reverts commit 66e8d4a14f.
* Revert "Make dict.fromkeys() a classmethod (which it is). (#604)"
This reverts commit 26dfcb6859.
* Add an explanation for fromkeys() being a staticmethod.
* Refine stubs for Python 2's decimal module
The decimal module for Python 2 was relatively incomplete, unlike the
decimal module for Python 3. This commit copies the relevant type
signatures from Python 3's decimal module to Python 2's.
There was a lot of code in both stubs and it wasn't clear to me if it
was safe to merge the two modules together, so I refrained from doing
so.
* Allow comparisions with Decimals and Floats
This commit loosens the types for Decimals to allow comparisons like
`Decimal('3.14') < 4.2`. Previously, you could compare decimals with
only other decimals or ints.
* 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.
* 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.
The documentation[1] says:
A comparison function is any callable that accept two arguments,
compares them, and returns a negative number for less-than, zero for
equality, or a positive number for greater-than.
This doesn't seem possible with the comparison function defined as
returning bool.
[1] https://docs.python.org/3.6/library/functools.html#functools.cmp_to_key