Matthew Wilkes and Jelle Zijlstra
d149fe435c
Represent the use of IntEnums in functions in socket.py. ( #3009 )
...
The Pull Request #1121 added the `AddressFamily` type to `socket.pyi`
for Python 3.4+, so constants such as `AF_INET` are correctly
represented as being an enum member rather than an int. The same is
true of the `SocketKind` enums in the `SOCK_*` family.
Various functions in the socket module can accept either an int
or an `AF_*` enum member as arguments, which is allowed by the
int argument type. However the `getaddrinfo` function returns an
`AddressFamily` member rather than an int in the first position
of its list members, so code that access enum specific members
such as the `name` attribute causes a typing error to be found.
This change corrects the return type of `getaddrinfo` but leaves
the family parameters as int, given that `AddressFamily` members
are `IntEnum` and only ever treated as `int`s internally.
2019-06-19 15:14:15 -07:00
Motoki Naruse and Sebastian Rittau
aa56af7dce
HTMLParser.get_starttag_text() can return None ( #3072 )
2019-06-19 15:34:37 +02:00
Ivan Levkivskyi and GitHub
01c2fa5a14
Sync recent typing and typing_extensions updates ( #3070 )
...
This includes two things to sync up with recent runtime updates:
* Move `Final`, `@final`, `Literal`, and `TypedDict` to `typing` (`typing_extensions` still defines or re-exports them)
* Rename `@typing.runtime` to `@typing.runtime_checkable`, while keeping `@runtime` as a backwards-compatible alias in `typing_extensions`.
2019-06-18 02:31:54 +01:00
Carl Meyer and Sebastian Rittau
fcb97fe8f1
Overload ast.parse to recognize that mode=exec means Module return. ( #3039 )
2019-06-17 23:27:14 +02:00
Jadiker and Sebastian Rittau
5447ff6bfe
str and unicode format functions take objects ( #3068 )
2019-06-17 20:09:11 +02:00
Alexander Fasching and Jelle Zijlstra
6258e7ddfd
ssl.pyi: fix types of cadata argument ( #3063 )
2019-06-16 14:11:10 -07:00
Sean Vig and Sebastian Rittau
1efebf78e4
Marshal dumps/loads uses bytes ( #3061 )
...
The marshal.dumps and marshal.loads functions should return and accept
bytes, respectively, rather than a string.
2019-06-16 16:17:26 +02:00
Eric Arellano and Jelle Zijlstra
d36a519b95
Update select and selectors to use _HasFileno protocol ( #3057 )
2019-06-15 16:35:18 -07:00
Utkarsh Gupta and Sebastian Rittau
8e7c32846f
request.pyi: Change Union[] -> Any for attributing status. ( #3045 )
...
Fixes #3026
2019-06-13 12:01:13 +02:00
John Freeman and Sebastian Rittau
e4a9cd580c
Add missing path-like annotation ( #3053 )
...
Fixes #3052
2019-06-12 20:03:14 +02:00
Ivan Levkivskyi and Jelle Zijlstra
5327484176
Use type annotation syntax ( #3048 )
2019-06-10 20:20:59 -07:00
Walter Scott Johnson and Sebastian Rittau
901cb33a3c
Mark asyncio loop parameters as Optional ( #3047 )
2019-06-10 20:58:31 +02:00
Rebecca Chen and Jelle Zijlstra
d64a26cf99
Add missing constructor to types.CodeType. ( #3040 )
...
I got the argument order from
https://github.com/python/cpython/blob/2bfc2dc214445550521074f428245b502d215eac/Objects/codeobject.c#L263
and the types from the attributes already in the stub.
2019-06-08 07:07:29 -07:00
Rebecca Chen and Jelle Zijlstra
e7184d6dfc
Add undocumented but used method LWPCookieJar.as_lwp_str. ( #3041 )
...
The method is defined here:
https://github.com/python/cpython/blob/e36ed475ea429f7cc80a4d65f80b44686a74b246/Lib/http/cookiejar.py#L1864
2019-06-08 07:06:14 -07:00
Ivan Levkivskyi and GitHub
61eb99664b
Add new semantic analyzer to mypy tests ( #3037 )
...
This also removes two redundant definitions in curses/__init__.pyi star-imported from _curses.
2019-06-07 16:49:57 +01:00
nabnut and Sebastian Rittau
87f96dc1f0
Add stub for queue.SimpleQueue in 3.7 ( #2995 )
...
Closes : #2994
2019-06-07 11:50:39 +02:00
J Rob Gant and Sebastian Rittau
40c4e4ff3d
Annotate HTMLParser attribute optional value ( #3034 )
...
Closes #3031
2019-06-05 18:51:52 +02:00
Benjamin Peterson and Sebastian Rittau
d6e2b02f72
Use custom tuple subclass for pwd.struct_passwd ( #3017 )
2019-06-05 11:59:32 +02:00
Radu Matei Lăcraru and Sebastian Rittau
a7785151aa
Make AsyncGeneratorType.aclose() properly return Awaitable[None] ( #3032 )
2019-06-05 11:20:23 +02:00
Rebecca Chen and Sebastian Rittau
f8093d63cd
Move stdlib/3/curses to stdlib/2and3/curses. ( #3025 )
...
Also add the A_ITALIC constant, which is new in 3.7.
2019-06-01 10:51:07 +02:00
秋葉 and Jelle Zijlstra
dd244d1200
fix Sniffer.sniff return type ( #3023 )
2019-05-31 07:22:36 -07:00
Utkarsh Gupta and Sebastian Rittau
020449a1ed
argparse.pyi: Allow Callable[[Text], _T] ( #3013 )
...
Fixes #2988
2019-05-27 14:39:04 +02:00
Brian Brunner and Sebastian Rittau
53500c8750
Make Timer args less restrictive ( #3007 )
...
Closes #3004
2019-05-23 15:08:48 +02:00
Sebastian Rittau and Jelle Zijlstra
260369e6e7
Use typing.Text for argument types ( #3000 )
...
Also, use just str for argument types in Python 3+ branches.
2019-05-21 19:53:47 -07:00
Viktor Roytman and Sebastian Rittau
07d4938251
Add missing methods to ItemsView and KeysView, including isdisjoint ( #2997 )
2019-05-20 02:12:22 +02:00
Saul Shanabrook and Sebastian Rittau
38a7f14658
Bound arguments are ordered ( #2998 )
...
The `arguments` attribute of the `BoundArguments` is specified as an "ordered, mutable mapping (collections.OrderedDict)"
not just a mutable mapping: https://docs.python.org/3/library/inspect.html#inspect.BoundArguments.arguments
2019-05-18 22:00:05 +02:00
Paul Dagnelie and Jelle Zijlstra
d13eb937f7
Implement SupportsIndex ( #2996 )
2019-05-16 21:55:57 -07:00
Dominic and Sebastian Rittau
5b63540b4b
Add sys.breakpointhook() and sys.__breakpointhook__ ( #2991 )
...
Closes #2979
2019-05-16 11:58:54 +02:00
Chad Dombrova and Sebastian Rittau
840631657f
Add undocumented member glob.has_magic ( #2972 )
2019-05-16 11:28:49 +02:00
秋葉 and Sebastian Rittau
a80066952e
Add missing annotation in cmath module ( #2989 )
2019-05-16 11:00:44 +02:00
Mark Mendoza and Jelle Zijlstra
2cf4af784c
Convert typing.ContextManager.exit to use dunder parameter names ( #2980 )
2019-05-15 13:30:20 -07:00
Ivan Levkivskyi and Sebastian Rittau
50d98acc76
Remove redundant variable definitions in ast module ( #2986 )
2019-05-13 19:32:24 +02:00
Ivan Levkivskyi and Sebastian Rittau
75723e3885
Add an optional opener parameter to open() function ( #2977 )
...
Fixes #2976
2019-05-09 16:59:32 +02:00
Jennifer Taylor and Sebastian Rittau
36b28e5b97
Split unittest stubs and add a few field ( #2973 )
2019-05-08 17:46:45 +02:00
Chad Dombrova and Sebastian Rittau
feb74cf9de
Add subprocess.list2cmdline for python 2 ( #2971 )
2019-05-08 10:21:32 +02:00
Mark Vismonte and Jelle Zijlstra
a193aacea8
Add py3.7 support to Future.add_done_callback ( #2970 )
2019-05-07 13:14:03 -04:00
Anirudh Padmarao and Jelle Zijlstra
53d4610579
Add stub for asyncio.BaseEventLoop ( #2960 )
2019-05-07 12:08:33 -04:00
Mark Vismonte and Sebastian Rittau
8451cd7819
Add annotation for Future._callbacks ( #2965 )
2019-05-07 18:02:41 +02:00
Jelle Zijlstra and Sebastian Rittau
b5493e8639
add types.FunctionType.__init__ ( #2968 )
...
Fixes #2930
2019-05-07 17:31:01 +02:00
Jelle Zijlstra and Sebastian Rittau
d7e9af4492
allow callables in dis() ( #2969 )
...
Fixes #2914
2019-05-07 17:21:54 +02:00
Jelle Zijlstra and GitHub
bdb1de57f5
narrow signature of __contains__ for str-like classes ( #2967 )
...
Fixes #2937
2019-05-07 10:24:28 -04:00
Mark Vismonte and Jelle Zijlstra
e4a81132c4
Fix Future.__init__'s loop variable annotation ( #2961 )
2019-05-06 22:02:56 -04:00
Mark Vismonte and Jelle Zijlstra
fe06e8e3c5
Add annotation to Future._loop ( #2959 )
2019-05-06 22:00:40 -04:00
berdario and Jelle Zijlstra
e45f443d85
Define functools.partial as overloaded function instead of its own class ( #2878 )
2019-05-06 12:05:02 -04:00
The Fox in the Shell and Jelle Zijlstra
e7d7a44411
Make the signature of ConfigParser.get() polymorphic ( #2406 )
...
The documentation [explicitly specifies](https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.get ) that `None` is a legitimate `fallback` value.
Thanks to @wiml for suggesting this approach.
2019-05-06 12:00:52 -04:00
Jan Szopinski and Jelle Zijlstra
bf2d51742b
unittest: Add overloads to assert(Not)AlmostEqual(s) ( #2901 )
2019-05-05 15:15:17 -04:00
Ethan Madden and Jelle Zijlstra
12fa5c4fdb
Added defs for undocumented attrs on enums ( #2941 )
...
This should resolve #2934
2019-05-05 15:07:22 -04:00
Michael A. Smith and Jelle Zijlstra
54069f4341
Annotate copy for MappingProxyType ( #2955 )
2019-05-05 14:10:59 -04:00
Jia Chen and Jelle Zijlstra
c4b249c9a8
Use dunder parameter name in _Writer.write ( #2954 )
2019-05-04 22:51:39 -04:00
Jia Chen and Jelle Zijlstra
ec16e435eb
Use dunder parameter name in Container.__contains__ ( #2953 )
...
According to Ivan, PEP 544 intentionally did not specify whether method conformance check in protocol inference should look at parameter names. For example, it's up to the type checker to decide whether a class with method defined as `def foo(self, x: int)` would implement a protocol with method `def foo(self, y: int)`.
Mypy decided to ignore parameter names altogether, but we Pyre team decided to be more strict and refuse to match different parameter names (as it is unsound to do so when those methods are invoked with named parameters). Since we rely on the typeshed stubs, we want to make sure at least the important stubs on typeshed conform to our standard.
This PR changes `Container.__contains__` to use dunder (i.e. positional-only) parameter name specified in PEP484. This change should not affect mypy since it ignores parameter names, but will make Pyre happy as it eliminate the naming requirement for all classes that want to conform to the `Container` protocol.
2019-05-04 22:00:47 -04:00