Commit Graph

2253 Commits

Author SHA1 Message Date
Sebastian Rittau
bbe9b94b00 smtplib improvements (#2419)
* Mark SMTP attibutes with class defaults with "= ..."
* Add SMTP.command_encoding
* Annotate SMTP.__exit__()
* Add SMTP.auth() et al.
* Add LMTP_PORT constant
2018-08-27 20:22:19 -07:00
Anthony Sottile
c3cf369c6f Document required= argument for add_subparsers in py37+ (#2416) 2018-08-23 19:39:34 -07:00
Teddy Sudol
c52c59f521 Remove duplicate adapters import. (#2414)
This causes an error in pytype.
2018-08-23 17:01:47 -07:00
Ollie Ford
2e7e8cc009 Add 3.7 variant of subprocess.run (#2409)
Python 3.7 added:
  - `text` as an alias of `universal_newlines`
  - `capture_output` for `stdout=PIPE,stderr=PIPE`

cf. https://docs.python.org/3.7/library/subprocess.html
2018-08-23 11:50:23 -07:00
Tomasz Trębski
50a62b6a6a Improve werkzeug/exceptions typings (#2405) 2018-08-22 08:49:11 -07:00
Ran Benita
8ab951c371 profile.run(sort=...) can be a string (#2413)
The int form is only accepted for backward compatibility.
https://docs.python.org/3/library/profile.html#pstats.Stats.sort_stats
2018-08-22 07:48:18 -07:00
Philipp Hahn
df516fab59 Some optparse improvements (#2290)
* optparse.Option.dest is a string

* optparse.OptionParser.epilog is a string

* optparse.OptionParser.prog is string

* optparse.OptionParser.values is Values

Shuffle code to resolve forward reference

* optparse.OptionParser.*option_list is a list of Options

* optparse.OptionParser.parse_args returns 2-tuple

<https://docs.python.org/2/library/optparse.html#parsing-arguments>

* minor improvements to Values
2018-08-21 21:51:30 -07:00
Teddy Sudol
2cd0aa16b5 Fix pkg_resources.pyi formatting (#2396) 2018-08-21 21:51:04 -07:00
Ilya Konstantinov
fe04d3aa2d Accept str in cast (#2408) 2018-08-21 07:53:35 -07:00
Jelle Zijlstra
9e023e7586 minor namedtuple fixes (#2227)
- The extra arguments aren't keyword-only in 2.7.
- Added the `defaults` argument in 3.7 (https://docs.python.org/3.7/library/collections.html#collections.namedtuple).
2018-08-19 03:47:10 +01:00
Goldstein
c3b5513475 Add annotations to runpy.pyi (#2395) 2018-08-18 19:25:48 -07:00
Matt Gilson
ebea29a0ed Make defaultdict.default_factory Optional. (#2401)
The API allows for setting this to `None`.  It makes the defaultdict behave more like a regular dict.

Fixes #2375.
2018-08-18 19:22:15 -07:00
Teddy Sudol
0386f3daec Change mode: unicode to mode: Text (#2398)
Resolves #2397
2018-08-17 16:33:35 -07:00
Sebastian Rittau
b209a649a0 Add date.fromisoformat() (#2393) 2018-08-17 08:50:10 -07:00
Sebastian Rittau
25ac4d6af4 Implement StartResponse using a protocol (#2392)
* Add ExcInfo and OptExcInfo type aliases

* Implement StartResponse using a protocol

* Mark stub-only types with an underscore

* Remove wrong TODO note

python/mypy#1178 is about variable-length tuples, while exc_info()
always returns a tuple with length 3. Ideally, exc_info() would
return Union[Tuple[Type[_E], _E, TracebackType], Tuple[None, None, None]],
but that is a different issue.
2018-08-17 08:36:00 -07:00
Sebastian Rittau
a2676ec972 Improve werkzeug stubs (#2391) 2018-08-17 08:35:14 -07:00
Michael J. Sullivan
d45fc3daaf Fix typed_ast's Num type (#2387) 2018-08-16 11:36:13 +01:00
Brandon Lin
700efc43dd add missing stubs in cryptography rsa/serialization (#2376) 2018-08-15 20:50:56 -07:00
Sebastian Rittau
f25c9548ed Replace StartResponse arguments with ... (#2379)
StartResponse callbacks are required to accept and optional third argument.
Currently, there is no good way to describe this using type hints.
Previously, a Union was used, but that causes mypy to complain about any call
of start_response().
2018-08-15 10:41:39 -07:00
MinJune Kim
dc6d1ff8d3 Re-add .resolve() method to package_resources.Entrypoint (#2385)
Fixes #1463
2018-08-15 10:40:45 -07:00
David Zbarsky
099081016e Add more mmap constants (#2386) 2018-08-15 10:39:47 -07:00
Sebastian Rittau
7ad682b0ae Improve annotations for json.load() and loads() (#2382)
* loads() only accepts str as first argument for Python < 3.6
* Use a protocol for the first argument to load() (cf python/typing#564)
2018-08-14 10:41:33 -07:00
stevenjackson121
80a0a75f5f Add stubs for contextvars backport (3.5 and 3.6) (#2378)
* Add stubs for contextvars backport (3.5 and 3.6)

* Add contextvars to tests/check_consistent.py
2018-08-14 08:05:02 -07:00
Yusuke Miyazaki
29522f87c3 Allow sqlite3.connect to take PathLike object on Python 3.7+ (#2380) 2018-08-11 22:49:49 -07:00
Ivan Levkivskyi
126b3e17fd Revert #2347 (#2377) 2018-08-09 13:22:12 -07:00
Ville Skyttä
b0e9998c99 Complete smtplib and sync with 3.5+ (#2371) 2018-08-09 11:30:24 -07:00
Devin Fee
047040887b fix: list_commands returns strings (#2372)
list_commands previously returned `Iterable[click.Command]` and now returns `Iterable[str]` to comply with the method's return value.
2018-08-09 10:24:23 -07:00
Ville Skyttä
066d8becf9 socket.create_connection source_address can be bytes or bytearray too (#2370)
* socket.create_connection source_address can be bytes or bytearray too

* Sync applicable socket.create_connection changes to socket.getaddrinfo
2018-08-09 10:02:34 -07:00
Ville Skyttä
850d16a668 socket.recv* return type improvements (#2363) 2018-08-09 08:07:17 -07:00
Chelsea Voss
f6e2fb4401 Allow DictReader values to be None (#2346) (#2347) 2018-08-09 08:04:44 -07:00
Michael J. Sullivan
0f6f2abc30 Add another undocumented mypy_extension that we are trying out (#2374) 2018-08-09 15:57:46 +01:00
Michael Lee
bc8d68cd34 Add constructor for HTTPError in urllib2/urllib.error (#2373)
It seems that code using HTTPError previously worked by accident
because we used to accept arbitrary keyword arguments when
instantiating BaseException, or any subclass of BaseException
(see https://github.com/python/typeshed/pull/2348).

This commit adds in the correct constructor (which also lets the
user specify the arguments in keyword-argument form).

Note: I'm not very familiar with the urllib libraries, so I opted
to just add the signature and leave it up to somebody else to
fill in the types.
2018-08-08 17:05:35 -07:00
Ville Skyttä
5b2c8dc883 concurrent.futures: Sync with Python 3.7 (#2343) 2018-08-08 08:26:01 -07:00
Max Murin
e9a7f7cc0d Add missing protobuf stubs (#2368)
Added a few stubs to Protobuf descriptors. These appear in descriptor.py. These are all present in https://github.com/google/protobuf/blob/master/python/google/protobuf/descriptor.py.
2018-08-08 09:40:40 +01:00
Brandon Lin
7c263e3935 add set_time to OpenSSL.crypto.X509Store (#2367) 2018-08-07 22:22:26 -07:00
Michael J. Sullivan
e4656b1ac6 Add undocumented trait decorator to mypy_extensions (#2369)
`@trait` has special meaning to the experimental mypyc compiler,
slightly restricting the behavior of the class in exchange for
allowing it to be multiply inherited from.
2018-08-07 22:18:00 -07:00
Daniel Li
631d2768d6 Add stub for pathlib2 on Python 2.7 (#2351)
pathlib2 is the Python 2.7 backport of the pathlib module from Python 3.
Hence we use the same stub file for both.

The maintainer of pathlib2 granted permission for stubs to be added in
mcmtroffaes/pathlib2#44.
2018-08-07 10:27:18 -07:00
Ville Skyttä
5fc149bb31 Mark GzipFile.mtime as Optional[int] (#2365)
Unlike the corresponding constructor kwarg, this is an int, not float.
2018-08-07 10:22:46 -07:00
Gary van der Merwe
c1f89a90b4 Make dataclasses available as a backported third_party library. (#2354) 2018-08-07 10:04:33 -07:00
Yusuke Miyazaki
9a01b817f7 Add sockets attribute to asyncio.events.AbstractServer (#2364) 2018-08-07 10:03:14 -07:00
Stig Johan Berggren
92a697cabd Make BaseManager.register a classmethod (#2356) (#2357) 2018-08-07 10:02:21 -07:00
EFanZh
dddca3b167 Add _field_defaults field to typing.NamedTuple (#2362) 2018-08-07 10:01:40 -07:00
tikki
5a1ea5efb2 Minor fixes for zipfile (#2360)
* Add `is_dir` to `ZipFile`

* Allow `pathlib.Path` for `is_zipfile`
2018-08-06 09:48:53 -07:00
Ville Skyttä
7e62d3cdb1 Add missing sqlite3.dbapi2.Cursor return types (#2359) 2018-08-06 08:08:17 -07:00
Guido van Rossum
1965e9dd22 Add stub for toml (#2355)
See https://github.com/uiri/toml/issues/178
2018-08-02 23:02:49 -07:00
Olmo Kramer
4ca0a63027 Relate _curses.wrapper return type to its function arg (#2353)
`curses.wrapper` returns the return value of the function it is passed,
but its function argument is declared as `Callable[..., Any]` while its
return type is `None`. This changes the definition of `curses.wrapper`
to use a `TypeVar` that relates the return type of its function argument
to its own return type.
2018-08-01 07:57:45 -07:00
Michael J. Sullivan
8b5d4708a0 Change a use of frozenset[int] to FrozenSet[int] (#2352)
Using FrozenSet is I think preferred (because it works in general) and
I am about to propose a mypy PR that breaks this particular use.
2018-07-31 15:51:14 -07:00
Sebastian Rittau
1c8c6ec7d9 Add type hints to werkzeug's AcceptMixin (#2349)
* Add type hints to werkzeug's AcceptMixin

* Fix typo
2018-07-28 22:01:56 -07:00
David Euresti
4e40b035c8 BaseException does not take keyword arguments (#2348)
Fixes #2344
2018-07-27 13:28:43 -07:00
Martin DeMello
0c9f0d21d2 allow for unicode entity dicts in saxutils (#2345) 2018-07-24 11:18:23 -07:00