Ivan Levkivskyi
ec2cb8e44f
Convert selected ABCs to Protocols ( #1220 )
2017-11-19 08:52:16 -08:00
Ethan Smith
7737e519a3
Add __dict__ to object in Python 2 ( #1746 )
...
Use str as key type for __dict__
2017-11-16 08:44:48 -08:00
Semyon Proshev
3029357ad7
Add unicode.__rmul__ ( #1749 )
2017-11-16 08:31:55 -08:00
Jelle Zijlstra
83ca997140
Change more defaults to ... ( #1729 )
...
* codemod ': Any = None' ': Any = ...'
* codemod ': (Union|Optional)([^=]+)\s+=\s+-?\d+' ': \1\2 = ...'
* codemod ': (Union|Optional)([^=]+)\s*=\s*-?(None|False|True)' ': \1\2 = ...'
* codemod ': (int|float|bool)\s*=\s*-?\d+' ': \1 = ...'
* codemod ': (bool)\s*=\s*(False|True)' ': \1 = ...'
* codemod ': Any\s*=\s*(False|True|None)' ': Any = ...'
2017-11-13 06:56:24 -08:00
Alex Willmer
55f15427bd
Refine stdlib commands module (add mkarg(), mk2arg(), correct get*()) ( #1739 )
2017-11-12 22:44:51 -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
Alex Willmer
c7bc0bdb00
Add BaseException.__getitem__ & __getslice__ ( #1719 )
...
Refs python/mypy#4215
Fixes false positive
error: Value of type Exception is not indexable
2017-11-07 12:57:51 -08:00
anentropic
05f527c089
BaseException.__init__ accepts **kwargs ( #1704 )
2017-11-03 23:10:34 -07:00
Matthew Wright
0b721b7af5
Update type of "throw" method of generators to reflect that it can return a value ( #1672 )
2017-10-25 16:54:18 -04:00
hashstat
c366a1be55
Merge v2 and v3 array stubs ( #1670 )
...
See #1608
2017-10-25 09:46:25 -07:00
Guido van Rossum
05ffb1f912
Make initial_indent and subsequent_indent AnyStr in wrap() and fill() ( #1662 )
...
Leave them alone in TextWrap.__init__(), since I don't want to make the whole class generic.
2017-10-10 15:11:48 -07:00
Guido van Rossum
6d619e013c
Add textwrap.dedent() to Py2 stubs ( #1661 )
2017-10-10 10:07:18 -07:00
Suren Nihalani
898299969c
typeshed: declare that ordereddict's copy returns ordereddict ( #1656 )
2017-10-08 21:15:11 -07:00
Michael Lee
51829c1bc8
Update textwrap stubs ( #1634 )
...
This commit adds a few missing return types to the Python 3 textwrap
stubs and fleshes out the Python 2 textwrap stubs so they're on par with
the Python 3 version.
This change:
1. Changes the order of the arguments in Python 2 and Python 3
to match the order from the source code instead of the
documentation.
2. Adds other undocumented attributes besides whitespace_trans
(for consistency).
3. Moves the '*' argument in TextWrapper.__init__ for Python 3
to match the source code.
4. Made function stub formatting consistent with typeshed style
conventions.
2017-10-08 21:12:19 -07:00
Semyon Proshev
bc91a22e4e
Update datetime.timetuple and datetime.utctimetuple (Py3), and datetime.__init__ (Py2) ( #1648 )
...
* Update return type for datetime.timetuple and datetime.utctimetuple
* Fix microsecond parameter in datetime
2017-10-07 08:39:39 -07:00
Ashwini Chaudhary
c03e3a7ac0
Added stub for whichdb(py2) ( #1508 )
...
Added stub for whichdb(py2)
2017-10-06 19:04:18 -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
Matthias Kramm
03ec4023ff
Adjust ast imports to make pytype happy. ( #1617 )
...
Turns out that pytype is a bit more finicky about imports, and
differentiates between '*' imports for export, and imports
for use in the local pyi. This adjusts ast.pyi to make pytype
understand it again.
2017-09-22 06:27:27 -07:00
Amandine Lee
248f74d31b
ConfigParser should use IO[str] for IO functions ( #1621 )
2017-09-22 06:25:17 -07:00
David Novakovic
b4e89a078c
Second param of islice allows None. ( #1603 )
2017-09-20 14:55:16 -07:00
rchen152
3d505d0c6b
Re-export exception names in exceptions.pyi ( #1611 )
2017-09-19 15:19:40 -07:00
rchen152
c009caf316
Make exceptions.pyi import its definitions from __builtin__.pyi ( #1610 )
...
* Make exceptions.pyi import its definitions from __builtin__.pyi
* Make ReferenceError a full class again.
* Restore blank line at EOF.
2017-09-15 14:52:54 -07:00
rchen152
0bf2958257
Correct a typo in stdlib/2/symbol.pyi ( #1607 )
2017-09-14 14:33:20 -07:00
rchen152
1dfa570cae
Fix the definition of nlargest() in stdlib/2/heapq.pyi ( #1601 )
...
* Fix nlargest() in stdlib/2/heapq.pyi
* Fix nlargest() syntax
* key can be None in heapq.nlargest
2017-09-12 08:27:41 -07:00
rchen152
fd8be43044
Fix the return type of functools.update_wrapper() ( #1589 )
2017-09-05 20:03:51 -07:00
rchen152
8d5a233c6b
Fix the definition of itertools.tee() ( #1584 )
2017-09-05 16:21:14 -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
Daniel Watkins
1c8f43b86c
Add closefd keyword argument to Python 2's FileIO.__init__ ( #1555 )
...
Fixes #1553 .
2017-08-17 20:47:08 +02: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
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
3f9fafbbb7
Re-export code from _ast into ast. ( #1515 )
...
After mypy [started hiding](https://github.com/python/mypy/pull/3706 ) imported names in stubs unless `from ... import ...` is used, we found an error with stubs of ast module.
It looks like ast module should re-export everything in `_ast` and according to PEP 484, it can do that by doing `from _ast import *`, so this is what this PR does.
2017-08-03 15:57:20 -07:00
Ashwini Chaudhary
0c7b50378b
Added stub for mutex(py2) ( #1509 )
2017-08-02 08:32:10 -07:00
Ashwini Chaudhary
01a0c51acf
Added stub for sre_parse and sre_constants(py2) ( #1500 )
...
* Added stub for sre_parse (py2)
* Added missing import
* Added missing hints; Fixed _AvType and _TemplateType
* Added stub for sre_constants
2017-08-01 14:38:22 -07:00
Matthias Kramm
6f23d124c0
Remove subclass IOBase from TextIOBase. ( #1505 )
...
This used to cause TextIOBase to subclass both BinaryIO and TextIO, even
though those two are incompatible.
2017-07-28 21:07:37 -07:00
Semyon Proshev
72fbc459a7
Add __init__ to types.MethodType ( #1499 )
2017-07-26 08:38:27 -07:00
Thomas Grainger
15c8474e35
fix email.mime ( #1482 )
...
* add missing python 2 email.mime.application stub
* restore missing python 3 mime package
* Delete __init__.py
2017-07-26 08:29:30 -07:00
Michael Lee
6d3024fb19
Add NoReturn type to typing stubs ( #1496 )
2017-07-20 21:24:34 -07:00
Jelle Zijlstra
be7490322b
Counter: fix return value of most_common() ( #1491 )
...
https://docs.python.org/3/library/collections.html#collections.Counter.most_common
https://docs.python.org/2/library/collections.html#collections.Counter.most_common
2017-07-19 20:29:32 +03:00
Jelle Zijlstra
00ddb1c84a
encodings: IncrementalEncoder and Decoder concrete ( #1490 )
...
These stubs are identical in Python 2 and 3, but I believe they
should not be merged, because there are numerous other modules
in the encodings package, and some only exist in some Python
versions. I don't think we can support that in the 2and3
directory.
2017-07-19 20:28:43 +03:00
Ashwini Chaudhary
a4a34a0e73
Added stub for stringold module ( #1460 )
2017-07-16 15:08:27 -07:00
rchen152
643aedea1b
Fix the definition of LockType.__exit__. ( #1485 )
2017-07-13 17:30:51 -07:00
rchen152
6368baf42a
Remove duplicate names from posixpath.pyi. ( #1468 )
...
posixpath.pyi did a '*' import of genericpath.pyi and then redefined
everything it imported. Removes the duplicate definitions from posixpath
and improves the ones in genericpath.
2017-07-06 14:22:18 -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
Ashwini Chaudhary
1a9685c6ce
Added stub for Python 2's _threading_local ( #1461 )
2017-07-04 20:01:17 -07:00
Jelle Zijlstra
318cada66c
os: merge the top and bottom of os/__init__.pyi ( #1458 )
...
* os: merge the top and bottom of os/__init__.pyi
Part of #1427 . In preparation for merging the two stubs, I'm making the files
identical as much as possible. This PR merges the top of the file, down to
but not including the definition of statvfs_result, and the bottom up to
and including os.utime.
This PR mostly adds more "if sys.version_info" block. Until the merger
completes, we'll have some Python 2 blocks in the Python 3 stub and vice versa.
I also add a few missing constants and arguments.
In followup PRs I'll merge the rest of the file. I'll put the trickiest part
(the return values of functions like os.stat) in its own PR.
* back out DirEntry from py2
It relies on stat_result which we don't have yet in py2.
2017-07-04 19:30:55 -07:00
Jelle Zijlstra
a419b696d4
make os.path identical in Python 2 and 3 ( #1459 )
...
Part of #1427 . I don't think we can actually merge these until we merge
os/__init__.pyi too, which will take a few more PRs.
2017-07-04 19:27:27 -07:00
Jelle Zijlstra
f264eda4ed
builtins: mode argument to open can be unicode ( #1452 )
...
Part of #1411
Also remove some explicit parameter defaults.
2017-07-04 19:20:45 -07:00