Semyon Proshev
5223b26ec8
Add __round__ to int and float in Python 3 ( #2061 )
2018-04-17 14:25:04 -07:00
Alan Du
bd26c7bf84
Add __complex__ to complex ( #2004 )
...
* Add __complex__ to complex
complex SupportsComplex!
* Allow constructing complex from SupportsComplex
2018-04-03 07:14:52 -07:00
Matt Gilson
8e3182dafa
dict.fromkeys supports arbitrary iterables. ( #2012 )
...
This should fix #1529 .
2018-04-03 07:12:04 -07:00
Jelle Zijlstra
103056eecf
fix some TODOs ( #1994 )
...
- Made deque.maxlen read-only
- We don't support 3.2, so we don't care about signature changes in it
- There don't seem to be any missing set operations (I compared the dir() of this class to that of builtins.set)
2018-03-28 18:40:13 -07:00
Eric Wieser
6cf1ec9654
Mark all dunder attributes of BaseException as Optional ( #1992 )
...
All of these properties can be set to `None`.
Also updates `with_traceback` to only accept the values which can be stored in `__traceback__`
2018-03-28 07:55:10 -07:00
Semyon Proshev
ac70fdc614
Overloads for map ( #1990 )
2018-03-27 10:05:59 -07:00
rchen152
38dc8f5a6a
Switch usages of mypy_extensions.NoReturn over to typing.NoReturn. ( #1942 )
...
* Change mypy_extensions.NoReturn to typing.NoReturn everywhere.
2018-03-05 12:42:29 -08:00
Ivan Levkivskyi
7ae2f25216
Fix some problems introduced by recent commits. ( #1905 )
2018-02-20 13:34:48 -08:00
David Euresti
8ecb74012a
Add __divmod__ to numeric types ( #1900 )
...
Helps with #1889
2018-02-18 16:59:12 -08:00
Marti Raudsepp
d288f443b9
Merge {IO,Environment,Windows}Error into OSError for Python 3.3+ ( #1852 )
...
Starting with Python 3.3, IOError, EnvironmentError and WindowsError are
aliases for OSError, which has all the attributes.
Reference:
* https://docs.python.org/3/library/exceptions.html#OSError
* https://www.python.org/dev/peps/pep-3151/
* OSError: Drop Python <3.3 compatibility
* Use Any instead of Union for filename/filename2 type, per GvR comment
See: https://github.com/python/mypy/pull/4541
2018-02-14 16:33:56 +00:00
George King
1533602779
filter function: make the callable of the first overload non-optional so that mypy is able to select the second overload for the case. ( #1855 )
2018-02-05 10:50:40 -08:00
Marti Raudsepp
15f07f5d03
Add ImportError attributes name, path for Python 3.3+ ( #1849 )
...
Reference: https://docs.python.org/3/library/exceptions.html#ImportError
2018-02-01 07:38:26 -08:00
Semyon Proshev
3e00a8f8e1
PEP 553 and PEP 564 ( #1846 )
...
* Add `breakpoint` to builtins (PEP 553)
* Add new `time` functions (PEP 564)
2018-01-31 16:51:25 -08:00
Anthony Sottile
03044212d4
Add typings for bool __{r,}{and,or,xor}__ ( #1795 )
2017-12-20 21:04:55 -08:00
Ivan Levkivskyi
ec2cb8e44f
Convert selected ABCs to Protocols ( #1220 )
2017-11-19 08:52:16 -08:00
Jelle Zijlstra
324f1761f4
Change more defaults to ... ( #1727 )
2017-11-09 10:32:17 -08:00
Jelle Zijlstra
54dd6ba27c
Change numerous default values to ... ( #1722 )
...
This is the convention, and some default values (e.g. strings) apparently
break pytype.
2017-11-09 06:28:40 -08:00
Sebastian Steenbuck
2551b76bde
Replace default strings ' ' with ... ( #1721 )
...
This fixes a problem with pytype.
2017-11-08 08:49:54 -08:00
FichteFoll
f933b9384c
Refine str.maketrans and str.translate ( #1613 )
...
str.translate requires a Mapping or Sequence (in essence, anything
with __getitem__), not a Dict.
str.maketrans in the one-argument form only converts character string
keys to their unicode ordinal, leaving any of the values untouched.
This mapping may use both integers or strings as keys at the same time.
str.maketrans in the multi-argument form returns a dict with any of the
values str, int or None, as recognized by str.translate.
2017-11-07 18:55:05 -08:00
anentropic
05f527c089
BaseException.__init__ accepts **kwargs ( #1704 )
2017-11-03 23:10:34 -07:00
Travis Parker
355f30cc70
Correct return type of sum() builtin ( #1582 )
...
`sum([])` always returns the integer 0.
2017-10-04 21:42:35 -07:00
Jelle Zijlstra
78587dc895
Revert "make __class__ refer to the current object's class ( #1549 )" ( #1632 )
...
This reverts commit 1a164b630c .
Reverts python/typeshed#1549 .
See Guido's comments in the original PR.
2017-09-29 11:37:54 -07:00
Jelle Zijlstra
1a164b630c
make __class__ refer to the current object's class ( #1549 )
...
Fixes python/mypy#3061
2017-09-27 18:11:59 -07:00
Luka Sterbic
1f867d8ab8
Fix int(Union[str, int]) ( #1551 )
2017-09-23 09:59:15 -04:00
Melvyn Sopacua
ebed7c2ecb
Codeobject support ( #1606 )
2017-09-22 06:54:58 -07:00
Guido van Rossum
76685480e0
Misc fixes found by running mypy against Dropbox internal codebase "C". ( #1575 )
2017-08-25 20:34:13 -07:00
Garrett
975c9a09ef
Add range attributes ( #1561 )
2017-08-22 06:11:55 -07:00
Svyatoslav Ilinskiy
4491e415f9
Make operations on set take AbstractSet[object] ( #1533 )
...
Previously they were `AbstractSet[Any]`
2017-08-11 17:17:47 -07:00
Jelle Zijlstra
d60f26c448
add object.__dir__ in Python 3 ( #1532 )
...
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__()`.
2017-08-07 19:29:13 -07:00
Svyatoslav Ilinskiy
8ac0694056
Make functions any and all accept Iterable[object] ( #1531 )
...
Previously, they were accepting `Iterable`, which expanded to `Iterable[Any]`.
2017-08-07 17:13:43 -06:00
Svyatoslav Ilinskiy
aa68403230
Make BaseException's init accept object instead of Any ( #1518 )
2017-08-03 12:57:59 -07:00
Jelle Zijlstra
16aa0651ae
Revert "Add __new__ to str and int stubs in both Pythons. ( #1352 )" ( #1466 )
...
This reverts commit fed4e03e53 .
2017-07-06 14:21:54 -07:00
Guido van Rossum
350563223f
Add Optional[] for all remaining cases of x: <type> = None ( #1424 )
...
* Final round of adding Optional[] to type of arguments with default = None
* Update Travis to use --no-implicit-optionals and clarify CONTRIBUTING.md
2017-06-21 10:50:21 -07:00
Semyon Proshev
fed4e03e53
Add __new__ to str and int stubs in both Pythons. ( #1352 )
...
* Update default values to `...` in `__init__` and `__new__` in `int` and `str`.
* Add `__new__` to `enum.IntEnum` to override inherited `__new__`.
* Add `type: ignore` comment to `IntEnum`
2017-06-12 20:53:32 -07:00
Semyon Proshev
5db571a8f3
Update typing.MutableMapping.update stubs to allow keyword-only arguments ( #1370 )
2017-05-30 21:44:10 -07:00
Matthias Kramm
8d8a34cb83
Patch from @sfreilich: make itertools.ifilter predicate parameter Optional ( #1257 )
...
From Samuel Freilich:
In Python 2, the predicate parameter in itertools.ifilter and
itertools.ifilterfalse can be None, indicating that true or false values
should be retained (functionally equivalent to passing "bool" as the
predicate). In Python 3, filter and itertools.filterfalse have
the same behavior.
2017-05-09 17:50:11 -07:00
Matthew Page
0e21ac9892
Add stub for string.casefold
...
Exists in 3.3+
2017-05-05 11:11:25 -07:00
Jelle Zijlstra
d1da44dc1b
add bytes.__mod__ ( #1212 )
...
Fixes python/mypy#3247
Also reviewed some related logic:
- __mod__ was added to both bytes and bytearray with PEP 461, which went into 3.5
- str.__mod__ takes only one argument, and the signature calls it "value"
- In Python 2, bytearray doesn't have __mod__ (and typeshed correctly omits it)
2017-04-27 08:07:59 -07:00
Guido van Rossum
359c8cc313
Remove all mention of 'module' from typeshed. ( #1156 )
...
This depends on python/mypy#3107 .
2017-04-13 08:40:52 -07:00
James Saryerwinnie
c4ceae98db
Add filename attr to SyntaxError type ( #1126 )
2017-03-31 15:24:42 -07:00
George King
7c413c904d
exit function takes argument of any type. ( #1116 )
...
The type annotations for exit were incorrectly limited to int in two places; the others that I looked at are already correct.
2017-03-29 14:24:34 -07:00
Semyon Proshev
8c1690befc
Update stubs for classmethod and staticmethod in both Pythons. ( #1089 )
2017-03-29 10:19:17 -07:00
George King
18cc2cbf8c
Add correct optional default start/end parameters to str count, find, index, rfind, rindex. ( #1109 )
...
fixes #1108
2017-03-28 10:11:50 -07:00
Nathan Henrie
fb80dc3971
Add ModuleNotFoundError for Python >= 3.6 ( #1083 )
...
6f0eb93183/Objects/exceptions.c (L707)
https://docs.python.org/3/library/exceptions.html#ModuleNotFoundError
2017-03-23 18:16:53 -07:00
Semyon Proshev
78d0cc32df
Add __new__ to builtin dict ( #1056 )
2017-03-22 07:33:06 -07:00
Guido van Rossum
7587e7f1c1
Make PathLike generic in AnyStr ( #1060 )
2017-03-21 14:33:22 -07:00
Guido van Rossum
41561f11c7
Redo PathLike without importing os into builtins.
2017-03-21 10:50:10 -07:00
Guido van Rossum
baa61a151b
Revert "Update stub for builtin open function due to PEP-519."
...
This reverts commit 48b271c862 .
See https://github.com/python/typeshed/pull/991#issuecomment-288160993
for details; basically this disturbed mypy's bootstrap import cycle.
2017-03-21 10:45:06 -07:00
Ivan Levkivskyi
ed9f70c738
Replace frozenset with FrozenSet ( #1057 )
2017-03-21 07:52:34 -07:00
Jelle Zijlstra
25464cf0a7
Merge pull request #991 from JetBrains/sproshev/pep-519
...
Update `open`, `os.fspath`, `os.fsencode`, `os.fsdecode`, `pathlib.PurePath` and `pathlib.Path` stubs due to PEP-519
2017-03-21 07:38:50 -07:00