Commit Graph

1397 Commits

Author SHA1 Message Date
Jelle Zijlstra
dad65e4121 improve stubs for _codecs (#1219)
* improve stubs for _codecs

I noticed that many of these used AnyStr in a context where it doesn't make
sense. Found a few more things after reviewing _codecsmodule.c:
- Some Windows-only functions were omitted
- A few argument counts and names and return types were wrong

The Python 2 _codecs stub has many of the same issues, but the module is also
pretty similar between Python 2 and 3. I'm planning to send another PR after this
one to merge the two and move the stub into 2and3.

* correct platform name
2017-04-27 08:47:42 -07:00
Jelle Zijlstra
d394d8c6bf stub for pickletools (#1210) 2017-04-27 08:14:21 -07:00
Jelle Zijlstra
c1a736fd6d fixes to fileinput (#1218)
- Correct incorrect return type for hook_encoded
- Add PathLike support
- Add some missing types
- Remove incorrect use of AnyStr
2017-04-27 08:12:53 -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
Ivan Levkivskyi
c133a3aca7 First argument to traceback.extract_tb can be None (#1223)
* First argument to traceback.extract_tb can be None

* Add Optional also to print_tb, format_tb, and walk_tb
2017-04-27 08:07:40 -07:00
Jelle Zijlstra
c05570cf00 fix example in README.md (#1217)
"int or float" isn't valid.
2017-04-26 08:15:38 -07:00
Jelle Zijlstra
3101768f12 drop 3.2 (#1213)
Closes #1145.
2017-04-25 17:15:49 -07:00
Teddy Sudol
4e22318980 Add pyi for pydoc [Python 2.7] (#1187)
* Add pyi for pydoc [Python 2.7]

* Fixed issues

* A few more fixes

- `synopsis -> Optional[AnyStr]`
- `visiblename` takes a `Container`
- `getdoc -> Union...` not `AnyStr`

* `synopsis` and `source_synopsis`
2017-04-25 16:34:45 -07:00
Teddy Sudol
31f3066124 Created stubs for xmlrpclib [Python 2.7] (#1185)
* Created stubs for xmlrpclib

* Fixed issues with xmlrpclib

* Change `_Unmarshaller` from TypeVar to alias
2017-04-25 16:22:05 -07:00
Teddy Sudol
f71ea30cac Created pyi for SimpleHTTPServer [Python 2.7] (#1186) 2017-04-25 16:17:09 -07:00
Teddy Sudol
e5a0c46004 Add pyi for sets (Python2.7) (#1176) 2017-04-24 18:53:47 -07:00
Jelle Zijlstra
397f998368 Make json into a package to match the implementation (#1194)
This is the other half of fixing #1115.

Also fixed the stub for JSONDecodeError and made it only exist in 3.5+.

Didn't otherwise review the exact attributes and types in the package.
2017-04-24 15:32:05 -07:00
Jelle Zijlstra
5f2f96340f complete stubs for imp (#1193)
* complete stubs for imp

Helps fix #1115

* fix import
2017-04-24 15:31:29 -07:00
Jelle Zijlstra
e3f495b7e9 Add missing enum attributes (#1195)
Fixes #854 (unless there's more I'm missing).
2017-04-24 15:30:59 -07:00
Jelle Zijlstra
6f5c6b5078 add some missing constants (#1198)
Closes #2
2017-04-24 15:05:02 -07:00
Jelle Zijlstra
56bc0f5766 rewrite _operator stubs (#1196)
Fixes #835
2017-04-24 15:04:42 -07:00
Jelle Zijlstra
4ea4bf63f8 add some missing names to abc.pyi (#1199)
Fixes #304
2017-04-24 15:04:16 -07:00
Jelle Zijlstra
8f1875b97b fixes to xml.sax (#1201) 2017-04-24 15:03:07 -07:00
Jelle Zijlstra
e8e002d9c0 stubs for smtpd (#1203) 2017-04-24 15:02:51 -07:00
Jelle Zijlstra
0fcece539b Stubs for sched (#1204)
* stubs for sched

* can't use NamedTuple classes
2017-04-24 15:02:25 -07:00
Jelle Zijlstra
5a20d41d4a stubs for reprlib (#1205) 2017-04-24 14:57:26 -07:00
Jelle Zijlstra
bea973ac22 stub for pty (#1206)
https://docs.python.org/3/library/pty.html
2017-04-24 13:55:33 -07:00
Jelle Zijlstra
3e51331118 fix parent classes of mmap (#1190)
Fixes #1184
2017-04-22 15:55:23 -07:00
Jelle Zijlstra
01ce742298 Add .mypy_cache/ to .gitignore (#1192)
Since it's now generated by mypy by default.
2017-04-22 15:54:48 -07:00
Jelle Zijlstra
1350d7e4d2 Fixes for datetime and relativedelta (#1191)
Fixes #1163.
2017-04-22 15:52:55 -07:00
Jelle Zijlstra
8dc082dce5 fix arg names in string.pyi (#1188) 2017-04-21 17:52:48 -07:00
Jelle Zijlstra
77af85649b Revert "Sadly symlinks don't work on Windows. (#1173)" (#1189)
This reverts commit 8b835f9500.

(Because we've fixed the issue in python/mypy#3213.)
2017-04-21 16:25:10 -07:00
David Euresti
759da86478 Cleanup six.moves module (#1180)
* Cleanup six.moves

Regenerate files so all imports are present, comment out imports that fail.
Remove useless files.

* Fix flake8
2017-04-21 16:03:19 -07:00
Guido van Rossum
a934d57f3b [optparse] Change Uses of List[] to Sequence[] in argument positions. (#1179)
* Change Uses of List[] to Sequence[] in argument positions.

One of these (parse_args()) broke in real-world code, because the
expected type was List[Union[str, bytes]] but the actual type was
List[str] (because List is invariant).  That is ridiculous, so I
changed the accepted type to Sequence[_Text] which is covariant.  Then
I found a few other methods/functions that probably should also be
changed to Sequence, but I'm less certain of those.  I'm not at all
sure about the instance/class attributes, so I left those alone
(though I suspect those might also have to switch).

* Fixes suggested by code review

- Changed Sequence[Option] to Iterable[Option] everywhere
- Changed _process_args to plain List
2017-04-21 12:22:24 -07:00
Cooper Lees
6e1d915944 - Add support for PathLike to _PathType for Python 3.6 Unions only (#1165) 2017-04-21 10:13:33 -07:00
Jeremy Apthorp
55dc338bbf Add stub for asyncio.wrap_future (#1183)
Closes #1182.
2017-04-21 07:53:14 -07:00
Ethan
625ea80a99 update OptParse to work on 2and3 (#1164)
* update OptParse to work on 2and3

* remove duplicative dunder methods in Option

* Union Nones to Optional and Text->_Text
2017-04-19 06:10:07 -07:00
Sam Dunster
6582a8fb59 Add collections.abc.Collection (#1177) 2017-04-18 21:08:06 -07:00
Eddie Antonio Santos
244f89d8cd Add uri param for sqlite3.connect (Python 3.4+). (#1171) 2017-04-18 15:09:51 -07:00
Guido van Rossum
8b835f9500 Sadly symlinks don't work on Windows. (#1173)
So I have to make {ntpath,macpath}.pyi real copies of posixpath.pyi.
2017-04-18 11:55:02 -07:00
Guido van Rossum
bb0a841471 Make io._IOBase and its descendents concrete. (#1172)
This solves the issue with instantiating gzip.GzipFile() mentioned at
https://github.com/python/typeshed/pull/1160#issuecomment-294534004
2017-04-18 11:13:13 -07:00
Teddy Sudol
70f7f6cce6 Add more kwargs to distutils/core.setup() (#1170)
* Add more kwargs to distutils/core.setup()

These arguments are sourced from https://github.com/python-git/python/blob/master/Lib/distutils/core.py#L44 and https://github.com/python-git/python/blob/master/Lib/distutils/dist.py#L195

I do not claim that the list of kwargs is now complete.

* Add missing optional args values

* Remove duplicate, change "Dict" to "Mapping"
2017-04-17 15:06:36 -07:00
Teddy Sudol
243b67f0d2 Add compresslevel kwarg to tarfile (#1169)
https://docs.python.org/2/library/tarfile.html?highlight=compresslevel
2017-04-17 15:05:46 -07:00
Teddy Sudol
194c4c6eb0 Add stubs for *path.pyi in Python 3 stdlib (#1167) 2017-04-17 13:07:21 -07:00
Teddy Sudol
2961dddc1f Mark debuglevel argument as optional argument (#1168)
https://github.com/python-git/python/blob/master/Lib/urllib2.py#L1038
2017-04-17 13:06:47 -07:00
Teddy Sudol
f6619a4741 Add stubs for *path.pyi in Python 2.7 stdlib (#1166) 2017-04-17 13:06:35 -07:00
Jelle Zijlstra
e50fcaf658 add mypy_selftest.py (#1102)
* add mypy_selftest.py
* add selftest to Travis
2017-04-17 11:17:27 -07:00
Matthias Kramm
7e58389a27 a better definition for io.IOBase (#1160)
* a better definition for io.IOBase

* move BinaryIO superclass into _io._IOBase

* remove write() from _TextIOBase
2017-04-17 09:42:59 -07:00
rchen152
2c54640dce Remove types.pyi from the pytype blacklist. (#1162)
* Fix a few return types in stdlib/2/inspect.pyi.

* Rename _FrameRecord to _FrameInfo

* Correct some return types in itertools.pyi from Iterable to Iterator.

* Change types.pyi syntax that pytype can't parse.

* Remove types.pyi from the pytype blacklist.
2017-04-14 15:14:20 -07:00
Michał Masłowski
2ffee9df1b Require warning categories to be subclasses of Warning (#343)
CPython _warnings module implementation accepts Warning subclasses and None, but not any subclass of BaseException
specified in the stub. The stub for warnings is correct.
2017-04-14 09:21:34 -07:00
David Euresti
5ba1a01216 Make webbrowser module unicode friendly in Python 2 (#1159)
* Make webbrowser module unicode friendly in Python 2

* CR changes
2017-04-13 20:15:37 -07:00
Łukasz Langa
03119a237d Partial lib2to3 stubs (#1096)
* Partial lib2to3 stubs

* Use typing.Text instead of str

* Add a _Path shortcut for managing PathLike

* Respond to review, pgen2/driver

* Respond to review, pgen2/grammar

* Respond to review, pgen2/parse

* Respond to review, pgen2/pgen

* Respond to review, pgen2/token

* Respond to review, pgen2/tokenize

* Respond to review, pytree

* Move to 2and3

* Make pytype happy

* Respond to review nits

* Move _RawNode, _Convert to pytree and make the latter return None

* Make concrete Symbols subclasses for python and pattern

* Add missing Callable import
2017-04-13 20:14:35 -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
Łukasz Langa
f543ddd89a Move yaml stubs to 2and3 (#1155) 2017-04-12 21:09:23 -07:00
rchen152
51959f09c7 Change types.pyi syntax that pytype can't parse. (#1157)
* Fix a few return types in stdlib/2/inspect.pyi.

* Rename _FrameRecord to _FrameInfo

* Correct some return types in itertools.pyi from Iterable to Iterator.

* Change types.pyi syntax that pytype can't parse.
2017-04-12 16:11:03 -07:00