Commit Graph
100 Commits
Author SHA1 Message Date
Jelle Zijlstra 9bbcb0822d add difflib.diff_bytes and difflib.Match (#1336) 2017-05-26 09:32:34 -07:00
Jelle Zijlstra f8d06c88e5 fix reverse comparison in optparse (#1337) 2017-05-26 09:31:30 -07:00
Jelle Zijlstra 296f294b75 add fileinput.filelineno and fileinput.fileno (#1338) 2017-05-26 09:30:42 -07:00
Jelle Zijlstra d23fe74072 add some exception classes to shutil (#1334) 2017-05-26 09:30:20 -07:00
Jelle Zijlstra e8013fd808 add types.AsyncGeneratorType (#1322) 2017-05-26 08:37:39 -07:00
Jelle Zijlstra fefdf185c7 merge and complete linecache stubs (#1320) 2017-05-26 08:30:42 -07:00
Jelle Zijlstra 4f2dd0f446 remove unused type ignore flags (#1346)
Verified that none of those are necessary for pytype.
2017-05-26 08:28:51 -07:00
Jelle Zijlstra c31dcf4088 Add more flags to socket (#1348)
Also switch to PEP 526-style types in socket.
2017-05-26 08:25:20 -07:00
Jelle Zijlstra 2800002ebf add to calendar stub (#1359) 2017-05-26 06:27:08 -07:00
Jelle Zijlstra aeb19baa84 add symtable.symtable (#1360)
https://docs.python.org/3/library/symtable.html#symtable.symtable
and
https://docs.python.org/2/library/symtable.html#symtable.symtable
2017-05-25 19:39:15 -07:00
Jelle Zijlstra 3ed17cdb49 distutils.core.setup fixes (#1358)
- add include_package_data (which setuptools accepts)
- allow arbitrary other kwargs, because distutils.core.setup allows arbitrary kwargs and just passes them through to commands
2017-05-25 19:37:10 -07:00
Jelle Zijlstra c4e6ce319f minor fixes to email stubs (#1357) 2017-05-25 19:36:48 -07:00
Jelle Zijlstra 72a745b2f8 remove collections.MutableString (#1356)
It does not exist (some StackOverflow question I found suggests it was removed in 2.6).
2017-05-25 19:36:08 -07:00
Jelle Zijlstra fce4424c6e add http.client.error (#1355)
It's in __all__
2017-05-25 19:35:36 -07:00
Jelle Zijlstra a25b449ee0 add some missing classes and platform checks to socketserver (#1354)
These checks were already in SocketServer.pyi for Python 2.
2017-05-25 19:34:27 -07:00
Jelle Zijlstra 26d1ff8352 add tempfile.TMP_MAX for py3 (#1353) 2017-05-25 19:33:05 -07:00
Jelle Zijlstra 875b02e374 complete and merge weakref stubs (#1343) 2017-05-24 20:35:16 -07:00
Jelle Zijlstra 383d1dc9e1 mark cProfile as private in pstats.pyi (#1344) 2017-05-24 20:33:20 -07:00
Jelle Zijlstra d9bf214203 merge pickle stubs into 2and3 (#1328)
Followup from #1321
2017-05-24 14:57:58 -07:00
Jelle Zijlstra 6fe7cdb1c3 merge 2and3 stubs for select (#1333)
There don't seem to be significant changes between Python 2 and 3. The Python 2
stub was much better, so I mostly built off of it.
2017-05-24 14:57:11 -07:00
Jelle Zijlstra 6152bad0af add random.choices for 3.6 (#1329) 2017-05-24 14:09:52 -07:00
Jelle Zijlstra 89f27742ca add re.template (#1330) 2017-05-24 14:07:31 -07:00
Jelle Zijlstra 890190d349 add opcodes to pickle stubs (#1321) 2017-05-24 08:05:55 -07:00
Jelle Zijlstra 97f32a57a2 complete __future__ stubs (#1326)
We were missing the most important one.
2017-05-24 08:02:47 -07:00
Jelle Zijlstra 5e4165493a fix typo in importlib.abc (#1323) 2017-05-24 08:00:12 -07:00
Jelle Zijlstra c930e889ee merge 2 and 3 stubs for fileinput (#1319)
* merge 2 and 3 stubs for fileinput

Plus some minor fixes.

* pytype doesn't like generic type aliases
2017-05-24 07:58:56 -07:00
Jelle Zijlstra 4ea798b869 inspect.getmoduleinfo was removed in 3.6 (#1318)
Compare https://docs.python.org/3.5/library/inspect.html#inspect.getmoduleinfo
and https://docs.python.org/3.6/library/inspect.html
2017-05-23 16:52:16 -07:00
Jelle Zijlstra cca81d864a complete doctest stub (#1315)
* complete doctest stub

And merge it into 2and3 (the old stubs were virtually empty).

* note things changed in 3.4

2.7 also had an undocumented and deprecated doctest.Tester class. I'm going to leave it out until somebody asks for it to be added.
2017-05-23 16:34:34 -07:00
Jelle Zijlstra 6c5474ae8c various fixes to asyncio stubs (#1305) 2017-05-23 16:14:29 -07:00
Jelle Zijlstra 0bda8c0cef fixes and additions to the configparser stub (#1311)
* fixes and additions to the configparser stub

This broke pytype because of the type ignore. I think it's OK to blacklist
because another instance of this same error (stdlib/3/email/policy.pyi line 95)
is already blacklisted. We can remove it when the pytype parser is fixed to
allow type ignores in this context.

* add SectionProxy.__getattr__

* the __getattr__ returns Any

* don't need type ignore for pytype if we put it all on one line
2017-05-23 15:36:42 -07:00
Jelle Zijlstra 42cd0f59e5 add functools.partialmethod (#1316)
Plus other cleanup to the py3 functools stub
2017-05-23 15:36:09 -07:00
Jelle Zijlstra 9ae9a9e741 merge Python 2 and 3 stubs for difflib (#1313)
These were already virtually identical.

I didn't review the stubs themselves for correctness. I'll make some changes after this
PR is in.
2017-05-23 15:01:30 -07:00
Jelle Zijlstra 05a4059b3b make TimeTuple private in datetime.pyi (#1312)
Also, these stubs aren't incomplete.
2017-05-23 15:01:02 -07:00
Jelle Zijlstra 1dda4ac105 merge python 2 and 3 stubs for calendar (#1310)
These are pretty much the same in the stdlib, except that TimeEncoding
got renamed to different_locale.
2017-05-23 12:47:24 -07:00
Jelle Zijlstra 3267e2396b Dummy thread improvements (#1309)
* dummy_thread improvements

- Complete the Python 3 stub
- Add a Python 2 stub. They're close enough that they should go into 2and3, but
  the module name changed so we can't do that.

* fix my bugs
2017-05-23 12:46:42 -07:00
Jelle Zijlstra 48796411ed curses: make names private that don't exist at runtime (#1308)
And add some missing return types
2017-05-23 12:46:05 -07:00
Jelle Zijlstra 14f7492fe0 os.walk allows PathLike (#1306) 2017-05-23 12:45:40 -07:00
Jelle Zijlstra 6f6fa428ce fix some issues found by stubcheck (#1303)
- ThreadError exists (undocumented) on Python 3. It's an alias for _thread.error,
  but making it a separate exception seems fine.
- zipfile.error is an alias for BadZipFile on both Python versions.
- zlib.Compress and Decompress are not actually accessible at runtime.
2017-05-23 12:44:35 -07:00
Jelle Zijlstra 0aa7138c4e fixes to logging stubs (#1302)
Found with my stubcheck tool
2017-05-23 12:43:49 -07:00
Jelle Zijlstra 915a91f80d fix "isisgeneratorfunction" (#1301) 2017-05-23 09:51:54 -07:00
Jelle Zijlstra 764d949f04 make _ast.identifier private (#1307)
It doesn't exist at runtime.
2017-05-23 09:51:29 -07:00
Jelle Zijlstra d571f101ba fixes to selectors stub (#1304)
Make type aliases private; add defaults
2017-05-22 23:12:02 -07:00
Jelle Zijlstra 093a16f398 allow PEP 526-style annotations in all stubs (#1285)
Mypy, pytype, and PyCharm now all allow variable annotations in stubs; I think we already have some.
2017-05-22 11:15:48 -07:00
Jelle Zijlstra 15b6ace1e7 Add to core dev guidelines (#1279)
From https://github.com/python/typeshed/pull/1266#issuecomment-302916761.
2017-05-22 06:34:37 -07:00
Jelle Zijlstra 728b977729 Replace a number of default argument values with "..." (#1280)
pytype apparently doesn't like default values that aren't ints or
None/True/False.
2017-05-21 14:31:22 -07:00
Jelle Zijlstra 8d1114c0c3 allow string levels in logging (#1234)
* allow string levels in logging

* remove redundant Union member
2017-05-10 07:09:08 -07:00
Jelle Zijlstra 7dd2f80194 Fixes to ContextManager (#1249)
* add typing.ContextManager for 3.6+ only

This fixes the easier part of #655.

Would it make sense to add a generic typing.ContextManager that exists in any Python version?

* update comment

* fix argument types for ContextManager.__exit__

* add AsyncContextManager

* add @asynccontextmanager

* typing.ContextManager now always exists

* back out async-related changes

Will submit those in a separate PR later

* fix import order

* AbstractContextManager only exists in 3.6+

* AbstractContextManager -> ContextManager
2017-05-08 16:21:51 -07:00
Jelle Zijlstra 464761bfd3 Fixes to shutil stub in Python 3 (#1227)
Mostly PathLike support; also added the os.terminal_size namedtuple.
2017-05-01 08:30:41 -07:00
Jelle Zijlstra 238c869965 merge _codecs into 2and3 (#1228)
* merge _codecs into 1and3

* handle encoding maps correctly
2017-05-01 07:51:08 -07:00
Jelle Zijlstra 0728096541 stub for nturl2path (#1208) 2017-04-30 14:16:30 -07:00
Jelle Zijlstra b084bcd037 review exported names in collections stubs (#1197)
Fixes #709

I looked at dir(collections) in 2.7 and 3.6 and made sure the list of names matched the stubs.
2017-04-30 09:59:37 -07:00
Jelle Zijlstra b9e896d97c make type aliases in lxml.etree private (#1216)
Naming the alias "AnyStr" isn't a great idea since AnyStr normally means
the typevar.

Also removed some whitespace in accordance with typeshed style.
2017-04-30 09:36:37 -07:00
Jelle Zijlstra 7be1a6f1fd fix some types in poplib (#1225)
Fixes a problem introduced in #1211.
2017-04-30 08:56:42 -07:00
Jelle Zijlstra ee0f341ecb stub for poplib (#1211)
* stub for poplib

* poplib: str -> Text
2017-04-27 09:51:29 -07:00
Jelle Zijlstra 9cd8bba40f stub for nntplib (#1209)
Put this in stdlib/3 because it changed pretty radically in 3.2. We might be
able to move it to 2and3 later, but I want to focus on completing the Python 3
standard library first.
2017-04-27 08:48:22 -07:00
Jelle Zijlstra 1d6e3f492e Fix incorrect usage of AnyStr (#1215)
* Fix incorrect usage of AnyStr

- sqlite3 was using Union[bytes, AnyStr], which doesn't make sense
- The urllib functions I changed accept either bytes or str for their "safe"
  argument
- Also added supports for PathLike to pstats
- Remove some unused imports of AnyStr

* pstats: python 2 accepts unicode
2017-04-27 08:47:59 -07:00
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
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
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
Jelle Zijlstra e50fcaf658 add mypy_selftest.py (#1102)
* add mypy_selftest.py
* add selftest to Travis
2017-04-17 11:17:27 -07:00
Jelle Zijlstra aa0d0d152e fix typos in uiid (#1151)
From #1148
2017-04-09 18:15:58 -07:00
Jelle Zijlstra f7e4cb8c79 make enums support len() (#1139) 2017-04-05 08:22:28 -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
Jelle Zijlstra fa104ea456 Add stubs for symbol (#1047) 2017-03-23 08:26:45 -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
Jelle Zijlstra 8318953a17 remove if TYPE_CHECKING in sqlalchemy stub (#1074)
This isn't needed in typeshed, since the stubs aren't executed.
2017-03-22 08:02:38 -07:00
Jelle Zijlstra a74c31270d fix version check in cgi (#1069) 2017-03-22 07:29:01 -07:00
Jelle Zijlstra 34575af8e4 Add core dev guidelines (#1058)
* Add core dev guidelines
* add link to "Squash and merge"
2017-03-21 08:36:00 -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 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
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 53a42046cb Add tracemalloc (#1053)
* add stubs for tracemalloc

This one has especially nice documentation, even including type annotations.

* no PEP 526 so I can run tests locally

* fixes

* another one
2017-03-21 05:58:22 -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 2e1ebab0c8 Merge pull request #1054 from euresti/path_type
Use Union[bytes, Text] for paths in os.py
2017-03-20 22:51:51 -07:00