Commit Graph

159 Commits

Author SHA1 Message Date
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
Jelle Zijlstra
dca9adb9d3 Add stubs for symtable (#1048)
* add symtable
* fix name
2017-03-20 20:00:52 -07:00
Jelle Zijlstra
7448f23d9f spwd: move to 2and3 and add missing argument 2017-03-20 08:39:24 -07:00
Eddie Antonio Santos
16babfdfda Stub for tty (#1038)
Adds Python 2 and 3 stubs for `tty` module.  Addresses one of the missing stubs mentioned in #1019.
2017-03-19 17:35:31 -07:00
Jelle Zijlstra
658abe7c9e Merge and complete stubs for sysconfig (#1040)
* unify and complete sysconfig stubs

* add missing imports

* and another
2017-03-19 17:34:08 -07:00
Jelle Zijlstra
ee22a489d9 quopri: unify 2 and 3, add types 2017-03-19 13:08:54 -07:00
Jelle Zijlstra
7906059adb pyclbr: move to 2and3 (#1034)
* pyclbr: move to 2and3

This module is completely identical between 2 and 3 in CPython (apart from a small few syntax changes).

* fix typo
2017-03-19 13:05:07 -07:00
David Wetterau
f35500caa8 Add stub for "binhex" module for 2and3 (#1028)
* added binhex for 2 and 3

* fix flake8 and use IO
2017-03-18 16:28:22 -07:00
Jelle Zijlstra
cb7949b14e fixes to dis stubs (#1025)
- Add sys.version_info checks (mypy now supports them)
- Went over Python 3 docs and corrected a few things
- Reexport things that are imported from opcode
2017-03-18 14:50:31 -07:00
Jelle Zijlstra
52dcfeed12 merge 2 and 3 stubs for unicodedata (#1013)
* merge 2 and 3 stubs for unicodedata
* fix a few return types to str in py2
2017-03-17 10:39:44 -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
Jelle Zijlstra
11350ed8cc Fix missing argument types in py3 stdlib (#995)
Still missing a few in _subprocess (a Windows-only private module) and decimal
(I gave up).
2017-03-14 11:43:42 -07:00
David Euresti
514bf736da Add stub for ftplib to 2and3 (#956) 2017-03-14 08:22:05 -07:00
Jelle Zijlstra
eb07fd3c1a make sure typevars defined in stubs are private (#989)
And also a few type aliases I noticed in the process.

Found using 59f9cac095
2017-03-13 07:32:40 -07:00
Jelle Zijlstra
984307bf45 fix odd version comparisons (#988)
"> (3,)" works but looks like the code is checking for Python 4.

"<= (3, 5)" was intended to check for versions up to and including 3.5, and probably works that
way in current type checkers. However, sys.version_info is actually a 5-tuple that is greater
than (3, 5), so a hypothetical type checker that uses the full version info would interpret
this check incorrectly.

This ensures that all version_info comparisons use <, >=, ==, or !=.
2017-03-12 20:48:48 -07:00
Jelle Zijlstra
b6eec58d2c remove checks against patch versions (#987)
Both mypy and pytype only use the major and minor version in type checking. Using
checks like "sys.version_info >= (3, 4, 4)" won't actually work properly for
people type checking their code using version 3.4, because (3, 4) >= (3, 4, 4) will
always be false (at least in mypy's approach; not sure if pytype is different).
2017-03-12 20:16:09 -07:00
Jelle Zijlstra
cf6c563ce1 codecs: merge 2 and 3 stubs (#960) 2017-03-10 15:50:14 -08:00
David Euresti
a1e74b9261 Add stub for filecmp to 2and3 (#955)
* Add stub for filecmp to 2and3

* Fix spacing

* Moar spacing

* Use _SupportsBool

* Code review
2017-03-07 16:36:25 -08:00
David Euresti
63590301f7 Add stubs for py_compile. (#954)
* Add stubs for py_compile.

* Correct Text
2017-03-07 16:35:45 -08:00
Sebastian Meßmer
afde2fd234 Fix type stubs for logging (#972)
Add missing type for two parameters
2017-03-06 08:05:42 -08:00
lincolnq
59789b8a3e Improve types for xml.etree.ElementTree (#930)
* Improve types for xml.etree.ElementTree

Update signatures to reflect the following peculiarities of the
ElementTree library:

- The elementtree library accepts unicode or bytes for most xml values
  in python2, and coerces everywhere -- but in python3, only str makes
  sense.
- In python 2, the library produces str or unicode instances
  unpredictably, depending on whether the xml is decodeable as ascii or
  not. In python 3, it always produces str instances.
- The parser functions accept unicode or bytes in 2 and 3 -- again, will
  coerce individual instances so heterogeneous lists are ok.
- In python 3, the tostring functions produce bytes or str, depending on
  the value of the 'encoding' parameter.

* improve docs
* Improve ElementFactory type by specifying dict of 2nd arg
2017-02-22 20:43:09 -08:00
David Euresti
e3fb935ca4 Move opcode to 2and3 (#938)
* Move opcode to 2and3

* Fix python3 versions

* Fix tests

* Bring Dict back
2017-02-21 14:27:34 -08:00
Matthias Kramm
40754e312f fix import error in logging/__init__.pyi 2017-01-31 14:54:18 -08:00
Eklavya Sharma
bc092ded69 pstats: Add default value for kwarg (#905)
According to python library docs, pstats.Stats.__init__ has a
keyword argument `stream' whose default value is `sys.stdout`.
2017-01-31 11:42:14 +00:00