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
Jelle Zijlstra
555f45b876
remove "return" statements from builtins.pyi ( #986 )
...
Type checkers shouldn't care that these methods are returning the same object.
2017-03-12 19:33:29 -07:00
Ivan Levkivskyi
bd5b33f3b1
Fix frozenset ( #979 )
2017-03-10 13:59:32 -08:00
Andrey Vlasovskikh
295788b672
Missing special attributes of class instances inherited from object ( #943 )
...
* Missing special attributes of class instances inherited from object
* object.__reduce__ returns a tuple
It's up to its inheritors to return either a tuple or a string.
2017-02-20 11:50:14 -08:00
Andrey Vlasovskikh
7212f23f7b
Added missing 'property' attributes
2017-02-20 11:04:27 -08:00
Andrey Vlasovskikh
43c1369901
More precise type for 'slice' constructor
...
start and stop arguments are required even though they can be None.
2017-02-20 11:03:30 -08:00
5j9
f192b8c784
Update count, (r)find, and (r)index type hints for bytes and bytearray ( #923 )
...
The above methods have changed in version 3.3 to also accept an integer in
the range 0 to 255 as the subsequence.
Fixes python/mypy#2831
2017-02-08 15:21:41 -08:00
Andrey Vlasovskikh
bb33cb0119
Added __instancecheck__ and __subclasscheck__ to type ( #887 )
2017-01-29 11:17:01 -08:00
Andrey Vlasovskikh
8ce64ce782
Updates to slice built-in ( #891 )
...
Makes args and attributes optional.
2017-01-29 11:16:23 -08:00
Andrey Vlasovskikh
2b25b3ef6d
Argument of input() is not restricted to str ( #890 )
2017-01-29 10:34:32 -08:00
Andrey Vlasovskikh
c8435f4315
Added object.__sizeof__ ( #865 )
...
* Added object.__sizeof__
* Removed __sizeof__ inherited from object
* Made sqlite3 classes for Python 2 inherit from object
* Removed __sizeof__ inherited from object
2017-01-26 12:05:53 -08:00
Andrey Vlasovskikh
025f31dcc9
Added class super to builtins ( #867 )
2017-01-26 11:53:59 -08:00
Alex Frieder
cf98162fca
Add __bool__ to numeric builtin types
2017-01-20 12:41:16 -08:00