Shantanu and GitHub
fd203e663e
py39: add PEP 616 methods ( #4090 )
2020-05-27 19:24:25 -07:00
Rune Tynan and GitHub
fcdfacf944
Fix stubtest failures for socketserver on windows ( #4103 )
2020-05-27 19:34:35 +02:00
Rune Tynan and GitHub
e49c156d92
Add winreg stubs ( #3794 )
2020-05-27 17:15:08 +02:00
Rune Tynan and GitHub
5e80ca9e44
Fix stubtest failures for path files on windows ( #4096 )
2020-05-27 09:39:26 +02:00
Nguyễn Gia Phong and GitHub
0aa9060e66
Remove context manager hints in multiprocessing.pool in Python 2 ( #4060 )
2020-05-23 22:11:19 +02:00
Rebecca Chen and GitHub
037377f502
Mark the arguments to os.killpg as positional-only in Python 2. ( #4033 )
...
This was already done in Python 3. In Python 2 as well, this method does
not take keyword arguments.
2020-05-17 18:06:35 -07:00
Selim Belhaouane and GitHub
3ac1f86499
Change return annotation of Popen.poll to Optional[int] ( #3986 )
...
Fixes #3984
2020-05-13 10:18:25 -07:00
Ivan Levkivskyi and GitHub
8c7f489d1b
Organize special forms in typing ( #3966 )
...
This is an accompanying PR for https://github.com/python/mypy/pull/8779 , see https://github.com/python/mypy/pull/8779#issuecomment-624001349
I also noticed that Python 2 and Python 3 versions are a bit out of sync, so I also put them back in sync.
2020-05-05 13:55:31 +01:00
Shantanu and GitHub
e857ad6ba9
zip: add some overloads for heterogeneous tuples ( #3830 )
...
Technically this is a lie, since we return a heterogeneous iterator, not
a tuple. But since we don't have a way of typing heterogeneous
iterators, this is the best we can do.
Fixes https://github.com/python/mypy/issues/8454
2020-05-03 21:02:26 -07:00
Philipp Hahn and GitHub
84147ec9cb
sockeserver: Add undocumented internals ( #3924 )
...
the `rfile` and `wfile` members are already implemented by
StreamRequestHandler. In addition to them several (undocumented)
class and instance variables exist according to
<https://github.com/python/cpython/blob/master/Lib/socketserver.py#L742 >:
- `rbufsize`
- `wbufsize`
- `timeout`
- `disable_nagle_algorithm`
- `packet` and `socket` for datagrams
The already exist with Python 2.7
<https://github.com/python/cpython/blob/2.7/Lib/SocketServer.py#L677 >
```mermaid
classDiagram
BaseRequestHandler <|-- DatagramRequestHandler
BaseRequestHandler <|-- StreamRequestHandler
StreamRequestHandler <|-- BaseHTTPRequestHandler
```
2020-04-14 13:22:40 -07:00
Peter Pentchev and GitHub
0d7665d7b8
SyntaxError's filename and lineno may be undefined. ( #3918 )
...
The Python source (Objects/exceptions.c) explicitly checks for null
pointers before using the filename and lineno members. Some libraries,
e.g. pkg_resources, set filename and lineno to undefined values if
indeed none are appropriate.
2020-04-08 20:50:49 +02:00
Debjyoti Biswas and GitHub
f4a646d43c
Add PathLike to genericpath.exists and re-export ( #3897 )
...
Closes#3492
2020-04-02 09:51:59 +02:00
Peter Pentchev and GitHub
92741c74ff
subprocess.Popen(cwd) is optional in Python 2.x, too. ( #3857 )
2020-03-17 14:39:05 +01:00
Jan Verbeek and GitHub
6f159d9fc6
Make Python 2's inspect more tolerant of unicode ( #3847 )
2020-03-13 20:48:42 -07:00
Shantanu and GitHub
6b4fd79808
builtins: add mod to various power functions ( #3816 )
2020-03-06 11:07:05 +01:00
Jelle Zijlstra and GitHub
6a4044fd9b
Make frozenset covariant ( #3808 )
...
The convariance was lost in #1057
2020-03-04 19:24:03 -08:00
Ivan Levkivskyi and GitHub
8b28b49c61
Mark some obviously incomplete stubs as incomplete ( #3807 )
2020-03-04 17:02:14 +00:00
Ran Benita and GitHub
36c6f94de4
stdlib/2and3/builtins: change dict.fromkeys to classmethod ( #3798 )
...
The referenced issue in mypy is fixed.
2020-03-01 23:25:52 -08:00
Shantanu and GitHub
a19caac361
os.path: fix arg names ( #3748 )
2020-02-21 11:55:21 +01:00
Shantanu and GitHub
87791e4e15
re: various fixes ( #3746 )
...
* re: mark positional-only args
* re: fix escape arg name
* re: update whitelist
2020-02-21 11:55:11 +01:00
Mark and GitHub
39008d51c1
Make itertools.cycle a type ( #3732 )
2020-02-09 13:34:41 +01:00
Rune Tynan and GitHub
e8f85d9479
Fix missing types in builtins/__builtin__ ( #3705 )
...
* Fix missing type in builtins/__builtin__
* Add return type to memoryview cast
2020-02-02 22:13:48 -08:00
Wolf Honore and GitHub
211aec7b22
socketserver: Add missing attributes and methods for ForkingMixIn and ThreadingMixin ( #3672 )
...
* Add missing attributes and methods for ForkingMixIn and ThreadingMixin
* Copy socketserver.py to SocketServer.py
* Fix type of timeout
2020-02-01 09:30:43 -08:00
Shantanu and GitHub
70f0dc1491
builtins: fix bytearray.fromhex ( #3691 )
...
bytearray.fromhex is a classmethod, not a staticmethod
Mark positional-only args in the other fromhex's
2020-01-30 18:58:36 -08:00
Shantanu and GitHub
9798c243c9
builtins: start can be passed by keyword to sum in 3.8 ( #3692 )
2020-01-30 18:56:50 -08:00
Jan Verbeek and GitHub
95cafc0b7c
sys: Correct types of sys.displayhook, sys.excepthook and variants ( #3673 )
...
displayhook should accept any object, not just integers.
displayhook and excepthook may be assigned to, so they should be
Callable values rather than function definitions. That way it's fine
to assign a function with different argument names. Their dunder
variants are supposed to be constant.
2020-01-29 11:25:35 +01:00
Ilaï Deutel and Jelle Zijlstra
e7ddb21ae6
range.index() takes exactly one argument ( #3668 )
2020-01-27 20:19:12 -08:00
Shantanu and Sebastian Rittau
ed95668638
builtins.pow: improve annotation ( #3647 )
2020-01-24 09:20:46 +01:00
Shantanu and Sebastian Rittau
32563e9e1d
builtins: mark positional-only args as such ( #3648 )
2020-01-23 15:35:45 +01:00
Rebecca Chen and Sebastian Rittau
3b3fc6a57f
Make os.statvfs_result inherit from typing.NamedTuple. ( #3603 )
2020-01-10 22:42:29 +01:00
Shantanu and Jelle Zijlstra
61600d6877
memoryview: add cast, obj attribute ( #3598 )
...
Fixes #3594
2020-01-09 15:57:17 -08:00
Rebecca Chen and Jelle Zijlstra
e0151e724a
Make unittest.FunctionTestCase inherit from TestCase in Python 2. ( #3597 )
...
This makes the pyi file match the implementation:
https://github.com/python/cpython/blob/249706c1fbce04125d81bd9993e6c010ae30f8e4/Lib/unittest/case.py#L1019 .
I also removed a now-redundant `run` method from FunctionTestCase
because the mypy test complained about it having a different signature
from TestCase.run().
Context:
https://github.com/python/typeshed/pull/3550#issuecomment-572702513 .
2020-01-09 13:04:08 -08:00
Daniel Farley and Rebecca Chen
955e9c7da4
Unify file descriptor definitions ( #3584 )
...
The _types module can house any common type defintions used throughout
the rest of typeshed to keep defintions in sync.
First candidate is file descriptors where anything with `fileno()`
method is accepted. There were several different implementations in
various files that can be unified.
2020-01-08 17:25:36 -08:00
hauntsaninja and Jelle Zijlstra
1efc1baaf7
stdtypes: update for py38 ( #3580 )
2020-01-06 20:57:34 -08:00
Jason and Sebastian Rittau
a1331accbe
Update int.from_bytes to allow more than sequences ( #3571 )
...
`int.from_bytes` supports both iterables of ints and objects that define
__bytes__'. As an example `int.from_bytes(iter([1, 0]), 'little'))`
returns 1.
2020-01-05 16:02:10 +01:00
hauntsaninja and Sebastian Rittau
b7530cc79e
Add __init__ for subclasses of MappingView in python2 ( #3570 )
...
Resolves #3549 for python2
2020-01-05 15:11:38 +01:00
Faidon Liambotis and Jelle Zijlstra
d87a4ffe0b
socketserver.BaseRequestHandler: add missing hint ( #3524 )
...
Add hint for __init__().
Fixes #3523 .
2020-01-03 08:48:49 -08:00
layday and Jelle Zijlstra
e404e1592d
Preserve original type in total_ordering annotation ( #3552 )
...
See https://github.com/microsoft/pyright/issues/443
for reference.
2019-12-20 17:18:05 -08:00
Jan Verbeek and Sebastian Rittau
a705d59479
Add undocumented methods and make types more specific in 2/unittest ( #3550 )
2019-12-19 18:17:14 +01:00
hauntsaninja and Jelle Zijlstra
6b321548c4
random: fix type for sample ( #3525 )
...
Fixes #3374
2019-12-04 13:07:24 -08:00
Jelle Zijlstra and Sebastian Rittau
d215f502c6
Improve warnings stubs ( #3501 )
...
* merge 2and3 for _warnings
* move warn and warn_explicit into _warnings
2019-12-03 14:33:37 +01:00
hauntsaninja and Jelle Zijlstra
5fdd6ad1a5
builtins.print: make sep and end Optional ( #3468 ) ( #3511 )
...
The docs for Python 2 and Python 3 both explicitly mentions that None is a
valid value for sep and end.
https://docs.python.org/3/library/functions.html#print
2019-11-29 06:02:30 -08:00
robertschweizer and Jelle Zijlstra
a9a4fd0d42
Add ImportError constructor arguments ( #3512 )
2019-11-29 06:01:30 -08:00
Benjamin Peterson and Jelle Zijlstra
23c531df5a
Type socketserver's RequestHandlerClass as a callable. ( #3422 )
...
It's not uncommon to pass functions rather than actual types into the servers.
2019-11-25 20:18:17 -08:00
Ryan Hileman and Jelle Zijlstra
693678b4c3
add no_type_check_decorator stub for #2884 ( #3460 )
2019-11-25 19:46:57 -08:00
Denis Laxalde and Jukka Lehtosalo
838e02334e
Fix type of imp.find_module() ( #3465 )
...
find_module is documented to return a tuple (file, pathname,
description) where "file" is open file object and "description" a tuple
(suffix, mode, type). The type of "file" was wrong ("str" instead of
"IO[Any]") as well as that of "suffix" ("IO[Any]" instead of "str");
probably those type definitions were swapped.
Fixes #3466 .
2019-11-20 10:29:05 +00:00
Michael Seifert and Sebastian Rittau
97ecd2b91f
Change the return type of __reduce__ and __reduce_ex__ to Union[str, Tuple[Any, ...]] ( #3453 )
...
This allows subclasses to return strings (which are allowed) from these
methods without having mypy throwing an error.
Closes #3452
2019-11-10 15:48:56 +01:00
Diego Elio Pettenò and Jelle Zijlstra
99a6fb3108
Add the (deprecated) assertDictContainsSubset() to TestCase. ( #3437 )
...
Until this is removed from the standard library, it probably should stay in the typing.
Also update both 2 and 3 definitions to use Mapping[Any, Any], rather than Dict[Any, Any].
2019-11-04 08:10:45 -08:00
Diego Elio Pettenò and Jelle Zijlstra
7e27bf6bde
Allow datetime() with a delta=timedelta() in assert(Not)AlmostEqual(s). ( #3426 )
...
While the documentation does not seem to make this particularly
obvious, it is allowed.
2019-11-02 22:35:09 -07:00
Rune Tynan and Jelle Zijlstra
b112c20dad
Copyreg stubs ( #3387 )
2019-10-29 19:52:05 -07:00