Commit Graph

2748 Commits

Author SHA1 Message Date
Jason Gilholme
8b66e08745 Add Generic Typing to Queue.PriorityQueue and Queue.LifoQueue in python 2 (#3036) 2019-07-01 14:05:13 +02:00
Hynek Schlawack
47450629c9 Add TLSVersion & related attributes to SSLContext (#3097) 2019-07-01 14:03:57 +02:00
Benjamin Woodruff
3272307933 Make dataclasses.Field.metadata non-optional (#3094)
If `metadata` is `None` the Field constructor replaces it with an empty
mapping object, so this value can never be None.

https://github.com/python/cpython/blob/v3.7.3/Lib/dataclasses.py#L243
2019-06-28 18:28:50 -07:00
Rebecca Chen
5dc89fe8cf Add undocumented methods codecs.utf_16_be_{decode,encode}. (#3091)
I found the signatures here:
6a16b18224/Modules/_codecsmodule.c (L729)

https://github.com/google/pytype/issues/348 was opened against
pytype about utf_16_be_encode being missing.
2019-06-26 20:29:16 -07:00
Gordon Ball
7e9e91cb7b Restore default value to click.echo_via_pager (#3090) 2019-06-26 13:21:05 -07:00
Eric Arellano
8131bfc3f6 Install Black and isort autoformatters (#3069)
* Install Black and isort

* Add config via pyproject.toml

Notably we keep the convention of 130 line length.

* Add target python version
2019-06-24 08:44:20 +02:00
redshiftzero
64b12bf7f1 itsdangerous: update JSONWebSignatureSerializer.dumps return type (#3082)
On Python 2, a str is returned, however on Python 3 the return type
is bytes.
2019-06-22 14:15:37 -07:00
Chad Dombrova
e25c0cb128 "key" argument of builtin function sorted should be optional in python 2.7 (#3086) 2019-06-22 14:09:51 -07:00
Maarten ter Huurne
bdd49d0f3a Fix annotation of re.Match 'lastindex' and 'lastgroup' in Python 3 (#3085)
Both are None if there were no groups matched. Also 'lastgroup'
will be None if the matched group was nameless.

The Python 2 versions of these annotations already used Optional.
2019-06-22 10:18:16 -07:00
Jelle Zijlstra
b0c9fa4530 fix type of loop.sock_connect (#3073) 2019-06-21 17:31:51 +02:00
Jelle Zijlstra
ada0570efc Revert "Define functools.partial as overloaded function instead of its own class (#2878)" (#3077)
This reverts commit e45f443d85.
2019-06-20 20:39:49 -07:00
crusaderky
9941616b9e Add mp_context parameter to concurrent.futures.ProcessPoolExecutor (#3078)
Closes #3076
2019-06-20 19:42:26 +02:00
秋葉
2b6a99c39c fix ssl.Purpose type in py3 (#3054) 2019-06-20 19:41:32 +02:00
Rune Tynan
58221cf20e Add types and functions in types.py that are new in 3.7 (#3066)
* Add types and functions in types.py that are new in 3.7

* Update `resolve_bases` to accept any iterable of objects, and the same
for `new_class` if the version is at least 3.7

* Add comparison overrides implemented by MethodWrapperType

* Fix mypy error due to over-constrained `__eq__`
2019-06-19 15:20:57 -07:00
Eric Arellano
1763f51c0d Refactor tests/pytype_test.py (#3065) 2019-06-19 15:19:10 -07:00
Florian Ludwig
2e10326b50 change http.cookies.Morsel to Dict[str, Any] (#3060)
Morsel does cast any value to string and therfor any is the correct
typehint. For some keys other types then strings are more
appropiate anyway, max-age can take an integer (unix time) and http-only
a boolean.

Closes #3059
2019-06-19 15:17:16 -07:00
Matthew Wilkes
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
aa56af7dce HTMLParser.get_starttag_text() can return None (#3072) 2019-06-19 15:34:37 +02:00
Mathieu Bridon
38f253ed69 redis: Add some type hints (#3055) 2019-06-18 18:19:51 +02:00
Ivan Levkivskyi
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
fcb97fe8f1 Overload ast.parse to recognize that mode=exec means Module return. (#3039) 2019-06-17 23:27:14 +02:00
Jadiker
5447ff6bfe str and unicode format functions take objects (#3068) 2019-06-17 20:09:11 +02:00
Alexander Fasching
6258e7ddfd ssl.pyi: fix types of cadata argument (#3063) 2019-06-16 14:11:10 -07:00
Sean Vig
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
d36a519b95 Update select and selectors to use _HasFileno protocol (#3057) 2019-06-15 16:35:18 -07:00
Mark Mendoza
1f740a7926 Adding stubs for pyre_extensions (#3056) 2019-06-13 23:14:54 +02:00
Joe Juzl
8ffe20fc22 Add redis stream methods to the client stubs (#3051) 2019-06-13 09:24:39 -07:00
Utkarsh Gupta
8e7c32846f request.pyi: Change Union[] -> Any for attributing status. (#3045)
Fixes #3026
2019-06-13 12:01:13 +02:00
John Freeman
e4a9cd580c Add missing path-like annotation (#3053)
Fixes #3052
2019-06-12 20:03:14 +02:00
Sebastian Rittau
b9101e9c5e Add a few Redis types (#3016)
* StrictRedis is an alias for Redis in current redis

* Add a few types

* Add missing import

* Add missing argument and types
2019-06-12 09:18:48 -07:00
Ivan Levkivskyi
5327484176 Use type annotation syntax (#3048) 2019-06-10 20:20:59 -07:00
Walter Scott Johnson
901cb33a3c Mark asyncio loop parameters as Optional (#3047) 2019-06-10 20:58:31 +02:00
Anthony Sottile
ed2a851ed8 dateutil: byweekday can take weekday (#3046) 2019-06-10 11:21:50 -07:00
Connor Skees
55a566340a Add copy() method to requests.Session.headers (#3043)
* Add `copy()` method to requests.Session.headers

* Use one type annotation
2019-06-08 12:19:57 -07:00
Rebecca Chen
d64a26cf99 Add missing constructor to types.CodeType. (#3040)
I got the argument order from
2bfc2dc214/Objects/codeobject.c (L263)
and the types from the attributes already in the stub.
2019-06-08 07:07:29 -07:00
Rebecca Chen
e7184d6dfc Add undocumented but used method LWPCookieJar.as_lwp_str. (#3041)
The method is defined here:
e36ed475ea/Lib/http/cookiejar.py (L1864)
2019-06-08 07:06:14 -07:00
Ivan Levkivskyi
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
87f96dc1f0 Add stub for queue.SimpleQueue in 3.7 (#2995)
Closes: #2994
2019-06-07 11:50:39 +02:00
markedwards
5c94b58752 Add FullLoader and FullConstructor classes to yaml (#3035) 2019-06-06 17:47:39 +02:00
Evan Moses
db5fc492aa Added tojson_filter and detect_encoding to flask.json (#3030) 2019-06-05 23:39:49 +02:00
J Rob Gant
40c4e4ff3d Annotate HTMLParser attribute optional value (#3034)
Closes #3031
2019-06-05 18:51:52 +02:00
Sebastian Rittau
0e5b3770f8 Add a "pull requests welcome" batch (#3033)
We get quite a few bug reports where after a maintainer writes
"Pull Requests Welcome" we get a PR by the submitter. Maybe this
badge will help a bit to encourage people directly submit PRs,
reducing maintainer workload.
2019-06-05 07:51:01 -07:00
Benjamin Peterson
d6e2b02f72 Use custom tuple subclass for pwd.struct_passwd (#3017) 2019-06-05 11:59:32 +02:00
Radu Matei Lăcraru
a7785151aa Make AsyncGeneratorType.aclose() properly return Awaitable[None] (#3032) 2019-06-05 11:20:23 +02:00
Chandan Singh
233f2abf19 click: Use property decorator for read-only properties (#3028)
Since these properties do not have a setter, be explicit with the
`@property` decorator. This will allow type checkers to see that
assignment of these attributes is an error.

See https://github.com/python/typeshed/pull/3027#discussion_r289623016
for some related context.
2019-06-03 08:13:52 -07:00
Chandan Singh
018ecb3f16 Update Click to 7.0 (#3027)
Closes #3020.
2019-06-03 07:38:27 -07:00
Rebecca Chen
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
秋葉
dd244d1200 fix Sniffer.sniff return type (#3023) 2019-05-31 07:22:36 -07:00
Mathieu Bridon
6061ca404e Move Redis stubs to 2and3 (#3015)
They actually work for both Python 2 and 3, mostly because they aren't
really typed yet.
2019-05-29 15:45:46 +02:00
Mark Mendoza
d8e14d6ead [pyre] Adding IntVar to typing_extensions (#3008) 2019-05-28 19:48:13 +02:00