Commit Graph

182 Commits

Author SHA1 Message Date
Jelle Zijlstra
d394d8c6bf stub for pickletools (#1210) 2017-04-27 08:14:21 -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
6f5c6b5078 add some missing constants (#1198)
Closes #2
2017-04-24 15:05:02 -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
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
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
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
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
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
nimin98
20d9fcf858 Support callable contextmanagers in contextlib (#1152)
mypy could not recognize the case when we use contextmanager as a
decorator, which has been supported since Python 3.2.

In the following code snippet,

from contextlib import contextmanager

@contextmanager
def foo(arg1):
    try:
        print(arg1)
        print('1')
        yield
    finally:
        print('2')

@foo('0')
def foo2():
    print('3')

foo2()

we get mypy error as follows,
error: ContextManager[Any] not callable

The suggested changes can fix this error and properly reflect the
updated contextmanager usage pattern.
2017-04-11 14:51:03 -07:00
Jelle Zijlstra
aa0d0d152e fix typos in uiid (#1151)
From #1148
2017-04-09 18:15:58 -07:00
David Euresti
a7f87bb006 Merge uuid module into 2and3 (#1148)
* Merge and improve uuid module

* Move uuid into 2and3

* Fix mistyped things, add compare operators
2017-04-09 18:05:03 -07:00
David Euresti
f741429a75 Move socket into 2and3 (#1149)
* Merge socket modules

* Move socket to 2and3
2017-04-07 18:01:33 -07:00
David Euresti
8bed2fce93 Merge binascii module into 2and3 (#1144)
* Unify binascii module

* Move binascii to 2and3

* CR fixes

* Fix flakes

* Fix flakes better
2017-04-06 21:53:38 -07:00
David Euresti
6e75432504 Merge token module into 2and3 (#1146)
* Merge token module; add values from 3.5

* Move token to 2and3

* Switch to ellipsis for token
2017-04-06 18:46:14 -07:00
Carl Meyer
166e56a8f0 Fix missing 'type: ' in opcode.pyi (#1143) 2017-04-05 17:06:09 -07:00
David Euresti
8401fc6838 Move __future__ module into 2and3 (#1140)
* Merge __future__

* Move __future__ into 2and3
2017-04-05 13:54:46 -07:00
David Euresti
26f5ffd5ba Add stubs for cmd (#1128) 2017-04-05 13:54:05 -07:00
David Euresti
b9616f1517 Merge base64 module into 2and3 (#1141)
* Merge base64 module

* Move base64 into 2and3
2017-04-05 13:51:26 -07:00
David Euresti
47c325c0ae Merge _random into 2and3 (#1134)
* Merge random module

* Move _random into 2and3
2017-04-04 20:14:07 -07:00
David Euresti
bc2234dba2 Merge zlib into 2and3 (#1130)
* Fix types and merge zlib.pyi

* Move zlib into 2and3
2017-04-04 20:13:23 -07:00
David Euresti
56e7aa6b48 Simplify, fix, and merge copy module (#1132)
* Simplify and add missing types for copy module.

Error and error were missing.  I also removed the internal arg memo.

* Move copy module into 2and3

* Bring back internal kwargs
2017-04-04 09:59:25 -07:00
David Euresti
8d3c6b14f6 Move struct into 2and3 (#1129) 2017-04-03 09:37:20 -07:00
David Euresti
341716e63f Merge and rename stdlib/{2,3}/pprint.pyi into 2and3 (#1124)
* Merge stdlib/{2,3}/pprint.pyi

* Rename pprint.pyi into 2and3
2017-03-31 17:47:28 -07:00
Guido van Rossum
1ea3d2de57 Make all single-constraint TypeVars use bound= insteads (plus hack) (#1118)
Another attempt for #804, to unblock python/mypy#2626.
There's a work-around here for python/mypy#1551.
2017-03-29 14:59:24 -07:00
Jelle Zijlstra
84371e812c add Optional to exc_info and extra in logging (#1117)
None is the default value for these two arguments to logging.Logger._log (which
most other stuff in logging delegates to).

I was getting errors in my codebase because mypy now distinguishes between Any
and Optional[Any].
2017-03-29 13:45:48 -07:00
Guido van Rossum
671d3870c2 Add 'file' attribute to cgi.[Mini]FieldStorage (#1104) 2017-03-27 14:27:38 -07:00
Tim Abbott
1cc3489463 logging.makeRecord returns a LogRecord. (#1100) 2017-03-25 21:48:30 -07:00
Guido van Rossum
16074c1e66 Make cgi.escape() polymorphic in Python 2 (#1098) 2017-03-25 13:53:36 -07:00
Jelle Zijlstra
9e39eb6368 add stubs for timeit (#1064) 2017-03-23 08:25:56 -07:00
Jelle Zijlstra
e97da0687d stubs for telnetlib (#1065) 2017-03-23 08:25:38 -07:00
Jelle Zijlstra
cd2cc6330c add stubs for stringprep (#1066) 2017-03-23 08:25:09 -07:00
Jelle Zijlstra
fe8f865e37 stubs for sunau (#1067)
This is conveniently very similar to wave.
2017-03-23 08:24:24 -07:00
Jelle Zijlstra
acd9862fae stubs for tabnanny (#1068) 2017-03-23 08:23:52 -07:00
Jelle Zijlstra
df2970865b stubs for sndhdr (#1070) 2017-03-23 08:23:06 -07:00
Jelle Zijlstra
c1944f944e fix some missing ", ..." in tuples (#1079) 2017-03-22 21:04:39 -07:00
Luka Sterbic
1a2381828e Fix logging.Handler.format return type, should be str, not None (#1076) 2017-03-22 19:02:57 -07:00
Jelle Zijlstra
a74c31270d fix version check in cgi (#1069) 2017-03-22 07:29:01 -07:00
Jelle Zijlstra
7c2d82fcb5 Add to codecs.StreamReaderWriter stub (#1032)
* Add to codecs.StreamReaderWriter stub

Closes #732

* BinaryIO -> IO[_encoded]
2017-03-21 08:15:46 -07:00
Jelle Zijlstra
c8fd85579f add py2 stubs for dis (by moving them into 2and3) (#1033)
Only a few functions were added in early py3 relative to py2, so it seems
fine to use a single stub. 3.4 made bigger API changes.
2017-03-21 06:00:50 -07:00
Jelle Zijlstra
357f66db77 move cgi to 2and3 and add types (#1022)
* move cgi to 2and3 and add types

This is pretty stable between Python 2 and 3, and not very well documented.

* fix CI failures

* adjust comment

(want to force Travis to re-run)

* give up on overriding values
2017-03-21 05:56:52 -07:00
Jelle Zijlstra
111b7d646d add stubs for trace (#1055) 2017-03-21 05:54:48 -07:00
Jelle Zijlstra
7ceee447f0 stubs for uu 2017-03-20 21:11:30 -07:00
Jelle Zijlstra
e30f8f59ae stubs for wave (#1050)
* stubs for wave
* no PEP 526 for now
* fix missing import
2017-03-20 20:53:44 -07:00
Jelle Zijlstra
40db56e83c stubs for xdrlib 2017-03-20 20:32:44 -07:00