Jelle Zijlstra
fe4bea39a2
fix return type of linecache.getlines ( #1877 )
...
Randomly noticed this looking at the stub. Here is the code: https://github.com/python/cpython/blob/3.7/Lib/linecache.py#L37 .
2018-02-13 16:19:44 -08:00
Jelle Zijlstra
2dd85c3658
move os.stat_result into posix stub ( #1818 )
...
This removes the circular dependency between the os and posix stub, which
is somehow triggering python/mypy#4442 . We should ideally fix the mypy bug,
but since it's easy enough to fix the import cycle, we might as well do that
too.
2018-01-09 13:50:56 -08:00
Jelle Zijlstra
fb2c7b34e2
Improve itsdangerous stubs ( #1733 )
2018-01-02 12:50:22 -08:00
Jelle Zijlstra
4ee508a032
make os.scandir work as a context manager ( #1787 )
...
Rework of #1583 . Fixes #1573 .
See documentation in https://docs.python.org/3/library/os.html#os.scandir .
2018-01-02 10:17:38 -08:00
Jelle Zijlstra
6509eee80e
add util.pyi to blacklist ( #1800 )
2017-12-23 11:23:49 -08:00
Jelle Zijlstra
0eb7083f0e
move dateutil into 2and3 ( #1743 )
...
These stubs are identical since #1735 .
2017-12-23 06:38:55 -08:00
Jelle Zijlstra
533a05be45
Fix some of the last default values that are not ... ( #1731 )
...
* still one left in atomicwrites that I need to investigate further
* fix atomicwrites
2017-11-13 07:08:30 -08:00
Jelle Zijlstra
69bffd154a
Fix default values in click stubs to ... ( #1734 )
2017-11-13 07:07:20 -08:00
Jelle Zijlstra
8e75701eda
make Python 2 and 3 dateutil stubs identical ( #1735 )
...
So that they can be merged into 2and3. This PR also adds a few missing
elements to parser.pyi and corrects some mistakes in the Python 3 stub.
Refer to https://github.com/dateutil/dateutil/tree/master/dateutil
2017-11-13 07:06:34 -08:00
Jelle Zijlstra
84d0cbf776
move thrift to 2and3 ( #1736 )
...
thrift supports Python 3 as of version 0.10.0. These stubs are pure stubgen and
might not be much good, but they belong in 2and3.
2017-11-13 07:05:57 -08:00
Jelle Zijlstra
bcfd3bf554
Fill out croniter stubs and move to 2and3 ( #1737 )
...
* fill out croniter stub
* move to 2and3
2017-11-13 07:05:38 -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
Jelle Zijlstra
0080017d02
fill out bz2 stub ( #1728 )
...
- add a default value to ...
- add some missing version checks
- add some missing arguments
2017-11-13 06:55:43 -08:00
Jelle Zijlstra
97be335160
don't import enum in Python 2 ( #1724 )
...
* don't import enum in Python 2
Fixes a pytype issue from #1720 .
* move enums together
2017-11-10 10:23:22 -08:00
Jelle Zijlstra
9390a49600
complete multiprocessing.connection stub ( #1716 )
...
Adds additional public members based on https://github.com/python/cpython/blob/master/Lib/multiprocessing/connection.py#L10 and https://docs.python.org/3/library/multiprocessing.html#multiprocessing-listeners-clients .
I found some discrepancies in the docs while adding these stubs and filed python/cpython#4304 to address them.
2017-11-09 10:40:49 -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
Jelle Zijlstra
eaf8972e48
complete Python 3 gzip stub ( #1723 )
...
* complete python 3 gzip stub
* IOBase.closed is read-only
2017-11-09 05:56:55 -08:00
Jelle Zijlstra
735abe68dd
remove all lxml stubs for now ( #1664 )
...
Fixes #525 .
2017-11-07 07:54:01 -08:00
Jelle Zijlstra
c10dc67ad2
Re-export names in dateutil.tz ( #1669 )
...
Fixes #1665 .
2017-10-12 17:57:12 -07:00
Jelle Zijlstra
b54a711778
Recommend against creating incomplete stubs ( #1659 )
...
I disagree with the recommendation that users create incomplete stubs, because such stubs lead to false positive type checker errors (see for example #525 ). I would like to instead set a norm that all stubs should contain all public objects in the library they cover.
2017-10-10 08:27:47 -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
Jelle Zijlstra
4ea6c1cffb
sys: clean up ( #1545 )
...
- More precise types for trace and profile functions
- Remove redundant comments
2017-08-21 13:54:55 -07:00
Jelle Zijlstra
c40b7afc14
accept PathLike in os.scandir ( #1546 )
2017-08-21 13:54:22 -07:00
Jelle Zijlstra
5c328f12e1
configparser: support PathLike ( #1547 )
...
RawConfigParser.read has code explicitly supporting PathLike objects.
Also removed an unused import and widened the accepted type from
Sequence to Iterable.
2017-08-21 13:42:35 -07:00
Jelle Zijlstra
e20a36ada2
add to CONTRIBUTING ( #1560 )
...
Ask contributors to better explain their changes and link to documentation and code. These things generally make pull requests easier to review.
2017-08-21 13:26:00 -07:00
Jelle Zijlstra
d60f26c448
add object.__dir__ in Python 3 ( #1532 )
...
In Python 3 (but not Python 2), `object().__dir__()` works and returns a list of strings.
This is relevant when implementing a custom `__dir__` that invokes `super().__dir__()`.
2017-08-07 19:29:13 -07:00
Jelle Zijlstra
2d97894fa9
collections: make UserDict, UserList, and UserString concrete ( #1477 )
...
* collections: make UserDict, UserList, and UserString concrete
* add version checks
https://github.com/python/cpython/commit/573b44c18f69307d7dbc95c950aab57ef7ea303e
* remove redundant methods
2017-07-26 16:34:43 -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
Jelle Zijlstra
32d9c8cb8f
make io.IncrementalNewlineDecoder concrete ( #1489 )
...
Part of #1476
2017-07-19 20:28:25 +03:00
Jelle Zijlstra
74966bacd9
distutils: make Command classes non-abstract ( #1488 )
2017-07-19 20:28:16 +03:00
Jelle Zijlstra
ac651d2f8c
Fix a few TODOs ( #1487 )
...
* fix some easy TODOs
* fix io
2017-07-19 20:27:50 +03:00
Jelle Zijlstra
1515ed9f88
fix some abstract classes in third_party/ ( #1486 )
2017-07-19 20:27:22 +03:00
Jelle Zijlstra
0e26c1f936
asyncio: fix several types ( #1450 )
...
Fixes #1447
2017-07-06 14:22:55 -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
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
7ecc979211
locale: broaden type of val argument to format ( #1453 )
...
Fixes #1350
2017-07-04 19:21:12 -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
Jelle Zijlstra
9947c9d513
urlparse: allow unicode arguments in more places ( #1451 )
...
* urlparse: allow unicode arguments in more places
Part of #1411
urlunsplit() and similar functions accept either unicode or str in all
places. Their actual return type is unicode if any of the arguments is
unicode and nonempty, which the type system can't exactly express. I
left the return type as str because str is implicitly promoted to
unicode, so using the return type in a place that accepts unicode should
work.
unquote, parse_qs, and parse_qsl return unicode if you pass them unicode,
so AnyStr is appropriate in their stubs.
* fix type for urldefrag
The return type was wrong; this function returns a 2-tuple. The second member of the tuple is always a `str` if the argument type does not contain '#', and otherwise matches the type of the argument.
2017-07-04 19:20:23 -07:00
Jelle Zijlstra
fee2eaae30
xml.sax.saxutils: make some functions take AnyStr ( #1457 )
...
Fixes #1062
2017-07-04 19:18:43 -07:00
Jelle Zijlstra
2b97c02801
logging: make Logger inherit from Filterer ( #1448 )
...
Fixes #1401
2017-07-04 19:18:01 -07:00
Jelle Zijlstra
e980c8987b
tokenize: add generate_tokens in py3 ( #1449 )
...
Fixes #1433
This is undocumented but somebody is asking for it to be included.
2017-07-04 19:17:39 -07:00
Jelle Zijlstra
22f47fd478
add typing.AsyncContextManager and contextlib.asynccontextmanager ( #1432 )
...
Implements:
- https://github.com/python/typing/pull/438
- https://github.com/python/cpython/pull/360
Note that https://github.com/python/cpython/pull/1412 , which adds
contextlib.AbstractAsyncContextManager, has not yet been merged.
2017-06-27 10:39:40 -07:00
Jelle Zijlstra
4a5ff0bb11
use PEP 526-style annotations in os stubs ( #1428 )
...
And fix some TODOs.
This will help me check these stubs with my stubcheck tool, and is better
for consistency anyway.
2017-06-22 05:49:23 -07:00
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