Commit Graph

1001 Commits

Author SHA1 Message Date
Dmitry Shachnev c6c8d7e540 unittest: make assertIn/assertNotIn accept iterables (#2447)
Fixes #2381.
2018-09-11 18:48:44 +02:00
Sebastian Rittau 60548f122f AbstractEventLoop exception handler is optional (#2446)
Closes #1616

* get_exception_handler() is only available in 3.5
2018-09-11 08:26:57 -07:00
Sebastian Rittau 44bdf6c6c7 Fix RawConfigParser.readfp() annotation (#2443)
Closes #689
2018-09-11 08:22:36 -07:00
Zac Hatfield-Dodds 6afa610191 memoryview is a context manager (#2442)
Since Python 3.2, __enter__ returns self and __exit__ calls self.release()
2018-09-11 14:13:38 +02:00
Jelle Zijlstra 8b9e4c378a fix module argument to unittest.main (#2403) 2018-09-10 11:04:05 -07:00
Ivan Levkivskyi 8ed0159445 Remove duplicate method definitions in importlib and jinja2 (#2427) 2018-09-04 07:50:47 -07:00
Zsolt Dollenstein 5ed39dd8ce bring protocols.pyi more inline with documentation (#2421) 2018-08-31 13:56:57 +02:00
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
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
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
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 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
Ville Skyttä b0e9998c99 Complete smtplib and sync with 3.5+ (#2371) 2018-08-09 11:30:24 -07: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
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
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
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
David Euresti 4e40b035c8 BaseException does not take keyword arguments (#2348)
Fixes #2344
2018-07-27 13:28:43 -07:00
Ville Skyttä f5fc356928 markupbase: Fix unkown_decl typo (#2342) 2018-07-21 23:37:21 -07:00
Hynek Schlawack 7bdf4655e0 Add missing asyncio 3.7 top-level functions (#2320) 2018-07-20 08:10:52 -07:00
Linda_pp 0f8e0ad661 Add missing slow_callback_duration attribute to AbstractEventLoop (#2340) 2018-07-18 21:57:46 -07:00
Jelle Zijlstra 574807d9ea os.get_terminal_size also exists on Windows (#2338)
... at least according to https://docs.python.org/3/library/os.html#os.get_terminal_size.

Related to python/mypy#5370.
2018-07-18 10:25:12 -07:00
Omar Sandoval 42db5ad4f7 Add missing int.__index__() signature (#2335)
This has been present since Python 2.5.
2018-07-16 15:30:06 -07:00
Linda_pp 8d13a377d4 Allow to specify None to encoding parameter of fdopen (fix #2321) (#2324) 2018-07-11 19:43:13 -07:00
Sebastian Rittau a38dbc6c1e Merge decimal (#2306) 2018-07-09 19:03:01 -07:00
Yusuke Miyazaki 5bb58af6c8 Use float instead of Union[int, float] (#2308) 2018-07-09 19:02:03 -07:00
justinpawela 2a888416b2 Remove annotations from http.HTTPStatus enum members (#2314)
These type annotations are unnecessary and seem to confuse the type system.

* Remove annotation from PlistFormat enum members

Same rationale as python/typeshed#2314; same adverse effects observed.
2018-07-09 18:59:34 -07:00
Bruce Merry c541077ffb Accept AnyStr in unittest.assertRegex (#2315)
And also in assertNotRegex, assertRegexpMatches.

Closes #2312.
2018-07-09 13:23:18 -07:00
Josh Holland 347595bafb Make argument to sys.settrace optional (#2309) 2018-07-04 10:15:30 -07:00
Sebastian Rittau 853c6e88a9 Merge stdlib/3.3 into stdlib/3 (#2297) 2018-07-03 18:56:28 -07:00
Sebastian Rittau 2a36b4cf01 Move asyncio from 3.4 to 3 (#2307) 2018-07-03 09:06:04 -07:00
Sebastian Rittau 9229dd8f0c Merge stdlib/3.4 into stdlib/3 (#2303)
* Merge stdlib/3.4 into stdlib/3

* Move asyncio back to 3.4 for now
2018-07-03 08:13:54 -07:00
Yusuke Miyazaki 1ae2ba0fbe Use sys.platform instead of comments (#2286) 2018-07-03 08:13:04 -07:00
Yusuke Miyazaki 6192cce9d9 Avoid using string literals in type annotations (#2294) 2018-07-02 20:23:29 -07:00
Sebastian Rittau ce1504d9e9 Add missing cls argument to FileFinder.path_hook() (#2299) 2018-07-02 13:19:04 -07:00
Sebastian Rittau e767c38c37 Move lineno and col_offset to ast.AST (#2298)
Also, mark AST._attributes and _fields as class vars.

`lineno` and `col_offset` were previously defined on a few sub-classes of `AST`, e.g. `expr`, even though https://docs.python.org/3/library/ast.html explicitly states that `AST` has these two attributes. These attributes are only present if they were supplied as arguments to the constructor, but the same is true for the subclasses.
2018-07-02 13:18:38 -07:00
Yusuke Miyazaki 581705d9ee Prefer to use ellipsis over pass (#2292) 2018-06-28 10:29:45 -07:00
Sebastian Rittau b261b228ba Merge Python 2 and 3 shutil (#2259)
* Drop support for Python 3.3
* Merge Python 2 and 3 shutil
* Marked some arguments optional
* Changed callback return type from None to Any for more flexibility
2018-06-27 20:42:58 -07:00
Yusuke Miyazaki 86883d3df9 Remove unused import statements (#2282) 2018-06-27 20:14:57 -07:00
Sebastian Rittau 39d95f16cf Drop Python 3.3 support from importlib stubs (#2264) 2018-06-22 08:36:00 -07:00
Ethan Smith 507ad2dcbe importlib.util.find_spec has optional return type (#2270) 2018-06-22 08:06:06 -07:00
Sebastian Rittau 95eff73ab2 Drop Python 3.3 support from several stubs (#2265)
* Drop Python 3.3 support from several stubs

* Revert wrong socketserver changes
2018-06-20 16:49:47 -07:00
Sebastian Rittau b05e99297c Drop Python 3.3 support from several stubs (#2266)
* Drop Python 3.3 support from importlib stubs

* Drop Python 3.3 support from html and symbol stubs
2018-06-20 16:46:11 -07:00