Commit Graph

1975 Commits

Author SHA1 Message Date
NODA, Kai
fe1d7f4fd4 ssl.SSLContext(protocol) >= 3.5 has a default value (#2007)
Fix #1947

As discussed, pretended all 3.5.* have the default value although it was actually 3.5.3 which introduced it
2018-04-09 12:58:15 -07:00
Jelle Zijlstra
81a6ea43a5 try using --no-site-packages (#2036)
Fixes #2035.
2018-04-09 12:55:18 -07:00
Jelle Zijlstra
f37709f9c3 Merge stubs for sqlite3 (#2026)
As promised in #2014.

There are virtually no real changes between Python 2 and 3 in this module, but the stub had accumulated some meaningless differences. I also fixed a few incorrect types.
2018-04-09 12:32:59 -07:00
Jelle Zijlstra
3f456e335e add multiprocessing.Process.kill and close (#2027)
See https://docs.python.org/3.7/library/multiprocessing.html#multiprocessing.Process.kill.

Fixes #2022.
2018-04-09 12:04:14 -07:00
Jelle Zijlstra
d43eac60dd add email.parser.FeedParser (#2028)
Fixes #1985.
2018-04-09 12:03:43 -07:00
Jelle Zijlstra
6862434eae fix return type for itsdangerous.Signer.unsign (#2029)
Fixes #2011

Also fixed the argument type (it doesn't accept str).
2018-04-09 12:00:41 -07:00
NODA, Kai
b472130201 Improve asyncio APIs which take TCP port (#2006)
They have getaddrinfo(3) as their backend, and accept port='http' etc. You can even omit (pass None to) either of host or port for start_server() to effectively select 'localhost' and an arbitrary ephemeral port, respectively.
2018-04-08 23:17:32 -07:00
Matt Gilson
a994c47198 Fixup the boto stubs to allow mypy --strict. (#2032) 2018-04-08 12:41:04 -07:00
Jelle Zijlstra
8482b1030b fill out stubs for requests.structures (#1897)
Looked at https://github.com/requests/requests/blob/master/requests/structures.py.

The "data" argument to the CaseInsensitiveDict constructor is passed as is to .update(),
so I accept the same argument types as MutableMapping.update.

LookupDict is strangely named and implemented but the point seems to be that you
setattr its keys, and then can access them with both attribute access and subscripting.
See its usage in d1fb1a29ab/requests/status_codes.py (L102).
2018-04-06 11:36:43 -07:00
Jelle Zijlstra
482f207b3c os.fwalk supports bytes (#2013)
python/cpython@8f6b344 and https://bugs.python.org/issue28682.

I could not use the _PathLike alias because that includes bytes.

Part of #1965.
2018-04-06 11:22:15 -07:00
Jelle Zijlstra
d24799fd31 uncomment a few parts of six.moves (#2019) 2018-04-06 11:20:14 -07:00
Jelle Zijlstra
4ab720161a ResourceWarning doesn't exist in Python 2 (#2020)
Fixes #1971.
2018-04-06 11:19:34 -07:00
Jelle Zijlstra
54ecefef04 removals in Python 3.7 (#2018)
Last part of #1965.
2018-04-06 11:11:29 -07:00
Jelle Zijlstra
0acdfd1548 more 3.7 features (#2017) 2018-04-06 11:09:45 -07:00
Jelle Zijlstra
7cfbc7d17f more 3.7 features (#2015) 2018-04-06 11:09:11 -07:00
Jelle Zijlstra
ce0656a8c7 add some more Python 3.7 features (#2014) 2018-04-06 11:08:30 -07:00
Omar Sandoval
32b4eacea1 Add missing exitmsg argument to code.interact() (#2024)
According to https://docs.python.org/3/library/code.html#code.interact,
this was added in Python 3.6.
2018-04-06 07:02:58 -07:00
Danny Weinberg
12d60a2760 Allow passing None for gflags default string value (#2016) 2018-04-04 16:50:28 -07:00
Christopher Schramm
7f34bbcb88 Add pkgutil.ModuleInfo (#2010) 2018-04-04 15:15:43 -07:00
Jelle Zijlstra
0af84cd9a0 upgrade flake8, pin flake8-pyi version (#2001)
I'd prefer to pin the exact flake8-pyi version so that test runs are more reproducible.
2018-04-03 07:16:34 -07:00
Alan Du
603be5e1da Fix typehint of click progressbar (#2003)
* Fix typehint of click progressbar

* Oops -- stubs are *.pyi files
2018-04-03 07:16:17 -07:00
Alan Du
bd26c7bf84 Add __complex__ to complex (#2004)
* Add __complex__ to complex

complex SupportsComplex!

* Allow constructing complex from SupportsComplex
2018-04-03 07:14:52 -07:00
Matt Gilson
8e3182dafa dict.fromkeys supports arbitrary iterables. (#2012)
This should fix #1529.
2018-04-03 07:12:04 -07:00
Michael J. Sullivan
df55343e60 Fix some more ctypes issues (#2009)
* Make {C,WIN,PY}FUNCTYPE's restype argument optional (for void returns)
 * Make WinError return WindowsError
 * Don't have Array explicitly inherit from Sized
   (since inheriting from classes with different metaclasses causes problems, 
    and it is a protocol anyways)
 * Have Array.__iter__ properly return an Iterator instead of an Iterable
2018-03-30 18:03:52 -07:00
Michael J. Sullivan
9b99161ca9 Make argtypes in ctypes be a Sequence instead of a Tuple (#2005)
A lot of code uses lists here.
2018-03-29 14:55:56 -07:00
dgelessus
06aee52581 Fix some issues in ctypes (fixes #1983) (#1986)
* Support additional argument types for c_void_p parameters
* Don't allow passing bytes where a writable c_void_p is expected
* Fix type of ctypes._CDataMeta.__[r]mul__
* Rename ctypes._cparam to _CArgObject to match the real type name
* Fix value type of ctypes.HRESULT
* Add stub for ctypes.wintypes
* Fix trailing whitespace in ctypes.wintypes
* Add a workaround to ctypes.Array to fix incorrect typing in some cases
* Expand multiple assignments so mypy recognizes them as type aliases
* Rename ctypes._Pointer to pointer so it can be used externally
2018-03-29 12:41:42 -07:00
Bryce Guinta
f42724444f Update math stub arguments to reflect protocol support (#2002)
Update math.factorial to reflect support for __int__ protocol.
Update other math functions to reflect support for __float__
protocol.
2018-03-29 07:59:27 -07:00
Jelle Zijlstra
43e6c3c435 add more minor 3.7 new features (#2000)
part of #1965
2018-03-28 21:28:27 -07:00
Łukasz Langa
6a1d25b73e Document why E741 is ignored 2018-03-28 20:25:50 -07:00
Jelle Zijlstra
26e573ba1c change default value to ... in inspect.pyi (#1998)
This is in our style guide. This is the last piece of offending code; I just submitted ambv/flake8-pyi#10 to enforce the rule in the linter in the future.
2018-03-28 20:24:39 -07:00
Jelle Zijlstra
5201ccdfff add E741 to ignored flake8 codes (#1999)
This was introduced in a recent version (so it doesn't affect us right now but will if we upgrade the flake8 version used in tests). It gives errors like:
```
/home/travis/build/ambv/flake8-pyi/.tox/typeshed/tmp/typeshed/stdlib/3/re.pyi:21:9: E741 ambiguous variable name 'I'
/home/travis/build/ambv/flake8-pyi/.tox/typeshed/tmp/typeshed/stdlib/3/re.pyi:39:5: E741 ambiguous variable name 'I'
/home/travis/build/ambv/flake8-pyi/.tox/typeshed/tmp/typeshed/stdlib/3/re.pyi:58:5: E741 ambiguous variable name 'I'
/home/travis/build/ambv/flake8-pyi/.tox/typeshed/tmp/typeshed/third_party/2/OpenSSL/crypto.pyi:43:5: E741 ambiguous variable name 'O'
```
These aren't useful for typeshed, because regardless of whether it's good style, these libraries really do contain variables named `I` and `O`.
2018-03-28 20:24:24 -07:00
Jelle Zijlstra
371b805c23 improve selenium stubs (#1732) 2018-03-28 19:39:43 -07:00
Jelle Zijlstra
0c15e5bdcc Improve werkzeug stubs (#1730) 2018-03-28 19:38:35 -07:00
Evan Krall
4563c5a1ac ArgumentParser's add_argument returns the Action that was created. (#1881)
* ArgumentParser's add_argument returns the Action that was created.

* Make add_argument's dest parameter Optional. _ArgumentGroup's add_argument should also return the Action.
2018-03-28 19:09:22 -07:00
Sebastian Rittau
0170e6d3c7 traceback.print_exception(): Arguments optional in Python 3 (#1982) 2018-03-28 18:45:14 -07:00
Jelle Zijlstra
200273edeb add stub for importlib.resources (#1993)
Part of #1965
2018-03-28 18:44:40 -07:00
Jelle Zijlstra
103056eecf fix some TODOs (#1994)
- Made deque.maxlen read-only
- We don't support 3.2, so we don't care about signature changes in it
- There don't seem to be any missing set operations (I compared the dir() of this class to that of builtins.set)
2018-03-28 18:40:13 -07:00
Russell Cloran
a62c6be905 Make encoding and newline optional in tempfile (#1995)
`encoding` and `newline` have a default value of `None` in stdlib, for all of
the classes/functions that take these parameters.
2018-03-28 16:41:24 -07:00
Patrick Meyer
6c09e19847 Add missing attribute socket to asyncore (#1991)
* Add missing attribute socket to asyncore

* Mark asyncore.dispatcher.socket as optional and undocumented
2018-03-28 10:08:44 -07:00
Eric Wieser
6cf1ec9654 Mark all dunder attributes of BaseException as Optional (#1992)
All of these properties can be set to `None`.

Also updates `with_traceback` to only accept the values which can be stored in `__traceback__`
2018-03-28 07:55:10 -07:00
Semyon Proshev
ac70fdc614 Overloads for map (#1990) 2018-03-27 10:05:59 -07:00
Semyon Proshev
8ac7f68a86 Update return type for math.ceil in Python 2 (#1989) 2018-03-27 08:09:18 -07:00
Guido van Rossum
30791d4208 Give Python 2 sys.getprofile() and sys.gettrace() return types (Any). (#1988)
(In Python 3 their types are already correct.)
2018-03-26 18:37:04 -07:00
João Santos
afeecb478b RotatingFileHandler has a terminator property (#1952)
In python3 `RotatingFileHandler` is a subclass of `BaseRotatingHandler` which is a subclass of `FileHandler` which is a subclass of `StreamHandler` which as a `terminator` property but I'm getting a `"RotatingFileHandler" has no attribute "terminator"` error on my code.
2018-03-25 08:11:01 -07:00
Tuomas Suutari
4da20cb8b7 multiprocessing: Fix timeout args of AsyncResult methods (#1984)
The timeout argument of wait and get methods of AsyncResult accepts also
None so fix the type specification to include Optional.

Accepting None is not an implementation detail as it's clearly
documented too:

https://docs.python.org/2/library/multiprocessing.html#multiprocessing.pool.AsyncResult

https://docs.python.org/3/library/multiprocessing.html#multiprocessing.pool.AsyncResult
2018-03-24 08:15:39 -07:00
Michael J. Sullivan
eb571e9cbb Make protobuf's BaseContainer a MutableSequence (#1981) 2018-03-22 18:22:59 -07:00
David Euresti
097e9f5e71 Fix issue with attrib ordering. (#1980)
A call like this:

```
from attr import attrib
from attr.validators import optional, instance_of

c = attrib(default=None, validator=optional(instance_of(bytes)))
```

Was returning no return value, because the first overload was T -> T.
The solution was to change the ordering so that the first overload is
None -> T and infer the type from the other arguments.
2018-03-22 10:50:07 -07:00
Jelle Zijlstra
bbbffb5f4b implement some minor 3.7 features (#1966)
References:
- https://docs.python.org/dev/library/datetime.html#datetime.datetime.fromisoformat
- https://docs.python.org/dev/library/crypt.html#crypt.mksalt
- https://docs.python.org/dev/library/contextlib.html#contextlib.AbstractAsyncContextManager
- https://docs.python.org/dev/library/calendar.html#calendar.HTMLCalendar.cssclasses
- https://docs.python.org/dev/library/binascii.html#binascii.b2a_uu

Part of #1965.
2018-03-22 08:01:09 -07:00
matthewfranglen
9a6a7a2e75 See #1977: Delete DoneAndNotDoneFutures definition (#1978)
The generic type of the futures provided to the wait method cannot
currently be preserved through this definition. For now deleting the
unused NamedTuple is the best approach.
2018-03-22 07:59:13 -07:00
Jelle Zijlstra
b9c5e811df allow instantiating TracebackType in 3.7 (#1967)
See https://docs.python.org/dev/reference/datamodel.html#traceback-objects
and python/cpython#4793.

part of #1965
2018-03-21 15:26:23 -07:00