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
David Euresti
2fdcd2e9e8
Let MutableMapping.pop take a different default type. ( #1044 )
...
This is particularly useful for the idiom `d.pop(k, None)` to remove an item if it exists.
Fixes #278
2017-03-20 12:10:38 -07:00
Semyon Proshev
25c66a011e
Add zip stubs for 5 and more arguments. ( #1041 )
...
* Add `zip` stubs for 5 and more arguments.
* Update `zip` stubs for 6+ arguments.
2017-03-20 11:38:38 -07:00
David Euresti
d43f3be914
Unify stdlib/{2,3}/typing.pyi
...
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
2017-03-19 09:43:40 -07:00
Semyon Proshev
4cd137189a
Remove object as the only ancestor for classes in Python 3 stubs.
2017-03-18 14:57:57 -07:00
Tadeu Manoel
da6d4314d3
Add missing method 'indices' in 'slice' builtin ( #1007 )
2017-03-16 09:18:24 -07:00
Jelle Zijlstra
349ff59f33
change empty bodies from "pass" to "..."
...
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.
2017-03-16 09:13:08 -07:00
=^_^=
45f4a1e913
Allow nested tuples in isinstance/issubclass ( #998 )
...
Fixes #997
2017-03-14 08:04:12 -07:00
Ivan Levkivskyi
b430318ac0
Fix non-subscriptable type aliases ( #993 )
2017-03-13 17:24:34 -07:00
Semyon Proshev
48b271c862
Update stub for builtin open function due to PEP-519.
2017-03-13 18:33:02 +03:00
Ivan Levkivskyi
0bf23b3727
Add __annotations__ to Python 3 ( #990 )
2017-03-13 07:38:38 -07:00