Commit Graph

900 Commits

Author SHA1 Message Date
Stanislav Syekirin 4e1cc807aa adding a stub for tkinter.messagebox (#2113) 2018-05-13 08:36:11 -04:00
Phillip Schanely 86f9472bc9 Correct 2 typing comments in inspect module (#2110) 2018-05-12 01:27:29 -04:00
Omar Sandoval 0a30d22f0d Fix Python 3 round() signature (#2107)
In Python 3, the ndigits argument of round() defaults to None. If
ndigits is excluded or explicitly None, the result is always an int. If
ndigits is not None, the result should be the same type as the number.

$ cat test.py
from fractions import Fraction

print(type(round(0.1)))
print(type(round(0.1, None)))
print(type(round(0.1, 0)))

print(type(round(Fraction(1, 10))))
print(type(round(Fraction(1, 10), None)))
print(type(round(Fraction(1, 10), 0)))
$ python3 ./test.py
<class 'int'>
<class 'int'>
<class 'float'>
<class 'int'>
<class 'int'>
<class 'fractions.Fraction'>

Update the signatures to allow for an ndigits of None.
2018-05-11 14:02:09 -04:00
Salvo 'LtWorf' Tomaselli d289c20260 Add __new__ to tuple stub (#2092)
Closes: #2091

Apply suggestions from https://github.com/python/typeshed/pull/2092
2018-05-09 16:30:58 -07:00
Jasper Spaans 2df4a32cf5 Let email.message.MIMEPart inherit from Message (#2103)
Also removes some duplication.
2018-05-09 16:28:14 -07:00
Sebastian Rittau 09008599ce Merge Python 2 and 3 wsgiref (#2106)
* Merge Python 2 and 3 wsgiref

* Move wsigref to 2and3
2018-05-09 16:26:03 -07:00
Dominik Gabi 3f196bde44 Make NamedTuple._replace return instance of the self parameter. (#2102) 2018-05-09 16:24:23 -07:00
Guido van Rossum d854d7e2a0 Revert "Fix signature of generic_visit method (#2100)" (#2101)
This reverts commit 39576c5d41.

I merged too soon -- tests are failing.
2018-05-07 11:21:19 -07:00
Thomas Schaper 39576c5d41 Fix signature of generic_visit method (#2100)
This methods returns something that has the same type as the first argument.
Fixes #2085.
2018-05-07 11:20:20 -07:00
Andrew Svetlov 252d79981b Add a stub for sys.implementation (#2097) 2018-05-06 08:40:56 -07:00
Emil Hessman 97e261cce8 Define SimpleNamespace as a proper class (#2087) 2018-04-29 23:02:13 -07:00
Jelle Zijlstra c7e3e9890d add UserDict.__init__ for Python 3 (#2083)
Fixes #2075
2018-04-27 14:38:00 -07:00
Zabolekar 5ddff9c44a Add a stub for tkinter.filedialog and for the modules it imports (#2058) 2018-04-25 19:44:42 -07:00
Martijn Pieters ecae01a37d collections.OrderedDict dict views are reversible (#2079)
Add the *View subclasses for OrderedDict use, with appropriate __reversed__
hints.

Fixes python/typeshed#2078
2018-04-25 19:44:25 -07:00
Martin DeMello 2935017157 Add multiprocessing.dummy pyi files (#2059) 2018-04-18 19:20:01 -07:00
Semyon Proshev 5223b26ec8 Add __round__ to int and float in Python 3 (#2061) 2018-04-17 14:25:04 -07:00
Jelle Zijlstra b1a0b8ad6e add subprocess.STARTUPINFO and some associated constants (#2041) 2018-04-12 12:29:42 -07:00
Jelle Zijlstra 37aba00fe8 fix using ZipFile as a ContextManager (#2043) 2018-04-12 12:29:22 -07:00
Jelle Zijlstra 7cd2016931 add sys.base_exec_prefix and sys.base_prefix (#2047)
See https://docs.python.org/3/library/sys.html#sys.base_exec_prefix.

Required for https://github.com/python/mypy/pull/4888
2018-04-11 13:59:44 -07:00
Svend Sorensen 6c1dffed58 Make islice start and stop parameters optional (#2031)
From the documentation [1]: "If start is None, then iteration starts at zero."

[1] https://docs.python.org/3/library/itertools.html#itertools.islice.

PR #1603 made this change for Python 2.
2018-04-10 20:55:06 -07:00
John Reese a51b480609 Add type annotations for multiprocessing manager address/connect (#2033) 2018-04-10 20:54:23 -07:00
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 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 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 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
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
Jelle Zijlstra 43e6c3c435 add more minor 3.7 new features (#2000)
part of #1965
2018-03-28 21:28:27 -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 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
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
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
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
z33ky c2c48424da Add missing collections.defaultdict.__init__ overloads (#1957) (#1958) 2018-03-17 08:22:11 -07:00
Sebastian Rittau 97d3cea9d1 Add module constants for smtplib (#1962) 2018-03-15 16:01:23 -07:00
rchen152 eda3f36cb9 Make abc.abstractproperty a class inheriting from property. (#1964) 2018-03-15 15:59:14 -07:00
Nipunn Koorapati 5af337b438 Add subprocess annotation for TimeoutExpired (#1954) 2018-03-13 08:26:59 -07:00
Salvo 'LtWorf' Tomaselli 89e5d9607c Add missing headers field (#1946) 2018-03-06 21:36:33 -08:00
Ethan Smith 1c47458ac6 Add cache_clear to lru_cache (#1941) 2018-03-05 18:52:46 -08:00
rchen152 38dc8f5a6a Switch usages of mypy_extensions.NoReturn over to typing.NoReturn. (#1942)
* Change mypy_extensions.NoReturn to typing.NoReturn everywhere.
2018-03-05 12:42:29 -08:00
Miguel Gaiowski a8465da863 Add stub for subprocess.list2cmdline function (#1898) 2018-03-02 11:04:22 -08:00
Takuya Akiba 74345aa898 Add missing next method to iterators returned by Pool.imap (#1926) 2018-02-28 18:34:30 -08:00