Commit Graph

977 Commits

Author SHA1 Message Date
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
Sebastian Rittau
1184726417 Drop Python 3.3 support from email stubs (#2263) 2018-06-20 12:04:22 -07:00
Jukka Lehtosalo
feeb4e71ef Change mock classes to Any values to avoid false positives (#2255)
The previous definitions in `mock` caused many false positives in
internal Dropbox repositories.

One source of problems was `List[Mock]` not being compatible with
`List[SomeClass]`, since `list` is invariant.
2018-06-19 16:28:19 +01:00
Daniel Li
1a8455b444 Add thread_name_prefix to ThreadPoolExecutor stub (#2249)
The thread_name_prefix argument of ThreadPoolExecutor.__init__ was added
to the Python 2 backport in agronholm/pythonfutures#64.
2018-06-17 18:33:37 -07:00
Jelle Zijlstra
00cda79cf5 add io.TextIOWrapper.read in 3.3 (#2248)
This is needed to make TextIOWrapper and a few classes that inherit
from it concrete in 3.3. I am actually not sure whether this method
exists at runtime; there's nothing in
https://docs.python.org/3/library/io.html#io.TextIOWrapper
that suggests it was added in 3.4. In any case, it hardly matters
since 3.3 usage should be very rare now.
2018-06-17 23:47:07 +01:00
Jelle Zijlstra
3032fbdff1 make http.client.HTTPResponse concrete in 3.4 (#2244)
Matches the implementation in https://github.com/python/cpython/blob/3.4/Lib/http/client.py#L308

The ignore works around python/mypy#5027 (commented further up in the 3.5 branch).

Part of #1476.
2018-06-17 17:29:02 +01:00
Jelle Zijlstra
94ab32ba59 Fix abstract classes for Python 3 (#2239)
* add metaclass=ABCMeta to some classes

* mark some more classes as explicitly abstract

* make some more classes concrete
2018-06-16 10:18:54 -07:00
Jelle Zijlstra
341fa375ef cleanup in typing.pyi (#2241)
- Fix TODOs around TracebackType
- Don't use quotes for forward references
- Make Generator and AsyncGenerator attributes into properties
2018-06-16 08:24:52 -07:00
Daniel Li
5054465746 Make concurrent.futures stubs identical (#2237)
Make the Python 2 and 3 concurrent.futures stubs identical so fixes get
applied to both.

For example, #1305 and #2233 fixed the same problem at different times,
as did #1078 and #1911.

By making the stubs identical, we apply the fix from #1711 to Python 2.

Fixes #2234.
2018-06-15 10:03:19 -07:00
Anthony Sottile
56c93c85c0 Add NoReturn to execv* family of functions (#2226) 2018-06-15 07:55:45 -07:00
Jason Fried
451deba4ef memoryview type information inconsistent with runtime behavior (#2230)
memoryview type information inconsistent with documentation of typing module. 

`memoryview` should be a ByteString like the docs say. 
`memoryview.__init__` does not accept str, and instead of a union it should just accept ByteString. 
`memoryview.__iter__` returns an Iterator[int] not bytes.
2018-06-15 07:51:56 -07:00
Jelle Zijlstra
de86f15fa0 Make http.client.HTTPResponse a BinaryIO (#2218)
Fixes #2189.

The errors from mypy are a false positive (see python/mypy#5027).
2018-06-12 09:20:24 -07:00
Jelle Zijlstra
6bbf3d89eb Further improve codecs stubs (#2217)
- remove header comments
- uppercase type aliases
- remove old-style type annotations
- unquote forward refs
- reformat the file
- remove values for globals
- don't use private names from codecs stub in io.pyi
2018-06-11 22:24:34 -07:00
Jelle Zijlstra
d2469c0e89 fix type for itertools.product (#2129)
Fixes #1850.

The fix was already applied to Python 2, but the typevar-based solution there
leads to "cannot infer value of type variable" in mypy. I used the following
script to check:

```python
from itertools import product

reveal_type(product([1]))
reveal_type(product([1], ['x'], [False], [3.0], [(1,)], [('x',)], [{1}], [{1: 2}], repeat=5))
```
2018-06-11 15:52:44 -07:00
Jelle Zijlstra
ced5d61bb6 make urllib.response.addinfourl instantiable (#2134)
Fixes #1377 (because HTTPError is a subclass of addinfourl). Also part of #1476.
2018-06-11 15:43:53 -07:00
Jelle Zijlstra
4e6af84640 improve multiprocessing.Pool types (#2126)
Fixes #1703

Mostly introduce typevars to express that the return types match the return types of the
callbacks.

Removed comment about incompleteness since all documented classes from
https://docs.python.org/3/library/multiprocessing.html#module-multiprocessing.pool
are covered.
2018-06-11 14:42:57 -07:00
Jelle Zijlstra
f5a74fd5da remove Optional from type of __slots__ (#2128)
Fixes #1853
2018-06-11 14:29:11 -07:00
Jelle Zijlstra
cb293ebd2e switch order of base classes on awaitable classes (#2125)
Fixes #1940.

This makes it so that mypy will infer the common base class of these
classes to be Awaitable instead of Iterable. I verified that this
fixes the errors in the script posted by @neilconway.
2018-06-11 14:20:31 -07:00
Jelle Zijlstra
7abcd0f71f add ConfigParser.readfp in Python 3 (#2123)
https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.readfp

Fixes #2112
2018-06-11 14:10:52 -07:00
Jelle Zijlstra
53fde2ddf7 make timeout argument to Connection.poll Optional (#2122)
Fixes #2094
2018-06-11 14:04:45 -07:00
Jelle Zijlstra
91af6291b1 make shlex.shlex and multiprocessing.pool.IMapIterator instantiable (#2120)
Part of #1476.
2018-06-11 14:04:05 -07:00
Jelle Zijlstra
28f6c095d4 make http.cookies.{Base,Simple}Cookie instantiable (#2116)
Part of #1476.
2018-06-11 14:01:17 -07:00
Jelle Zijlstra
38fb53eab6 add __init__ to SimpleNamespace (#2207)
```In [11]: SimpleNamespace(x=3)
Out[11]: namespace(x=3)
```
2018-06-11 08:08:41 -07:00
Daniel Li
87c296c964 Some inspect.formatargspec args cannot be None (#2212)
The annotations, formatarg, formatvarargs, formatvarkw, formatvalue,
formatreturns, and formatannotations arguments to inspect.formatargspec
have default values, but they cannot be None.
2018-06-11 08:07:47 -07:00
Guido van Rossum
af3b015aa8 mock.patch.object() attribute arg should be Text (#2210)
It works and is needed for code using the dreaded
'from __future__ import unicode_literals'.
2018-06-09 22:36:24 -07:00