Commit Graph

1548 Commits

Author SHA1 Message Date
Jelle Zijlstra
c7e3e9890d add UserDict.__init__ for Python 3 (#2083)
Fixes #2075
2018-04-27 14:38:00 -07:00
Jelle Zijlstra
9e25506cab add missing attributes to Python 2 unicode errors (#2084) 2018-04-27 14:37:20 -07:00
Jelle Zijlstra
5554b0b19b argparse.ArgumentParser.error never returns (#2082)
And neither does `.exit`.

Fixes #2081.
2018-04-25 21:30:31 -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
Tomas Krizek
db5137b756 stdlib/selectors: change timeout argument type to float (#2070)
The Selector's code internally uses select.select and passes the
timeout argument to it. The documentation explicitly states the
timeout is a floating point number:
https://docs.python.org/3/library/select.html?highlight=select#select.select
2018-04-19 08:36:53 -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
Freek Dijkstra
55a3bad0f8 fix signature for difflib.get_close_matches (#2064)
Fixes #2063.

The second argument to difflib.get_close_matches not only accepts a List, but any Iterator.
2018-04-17 14:24:27 -07:00
Jelle Zijlstra
a5429d25dc add missing methods to DictMixin (#2054)
Fixes #1896.
2018-04-14 14:21:07 -07:00
Siva Chandra
035774e022 Adjust return types of shed.scheduler.run. (#2050) 2018-04-13 21:00:27 -07:00
Michael J. Sullivan
d63866bd36 Fix py2 unicode handling for ArgumentParser.add_argument's text arg (#2051)
add_argument's type argument was recently changed to be (approximately)
`Callable[[_Text], _T]`. Because of contravariant subtyping for functions,
this had the effect of requiring that add_argument *always*
be unicode, which is wrong.

Change it to be `Callable[[str], _T]`.
2018-04-12 20:45:48 -07:00
Jelle Zijlstra
b1a0b8ad6e add subprocess.STARTUPINFO and some associated constants (#2041) 2018-04-12 12:29:42 -07:00
Jelle Zijlstra
0f425db197 fix types for unittest.TestLoader.loadTestsFrom* methods (#2042)
Fixes #2008.
2018-04-12 12:29:32 -07:00
Jelle Zijlstra
37aba00fe8 fix using ZipFile as a ContextManager (#2043) 2018-04-12 12:29:22 -07:00
Jelle Zijlstra
b8b78886e3 add some Optionals to traceback.pyi (#2044)
Fixes #1974
2018-04-12 12:29:07 -07:00
Jelle Zijlstra
840f34147e add a lot more distutils.errors (#2045)
Fixes #1963.

See https://github.com/python/cpython/blob/2.7/Lib/distutils/errors.py and https://github.com/python/cpython/blob/3.7/Lib/distutils/errors.py.
2018-04-12 12:28:55 -07:00
Eddie Schoute
5327841a18 Add pathlib.Path.__enter__ and __exit__ (#2048) 2018-04-12 10:39:19 -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
Chris Gavin
dca53fb2bd Make the help argument of argparse.add_argument Optional. (#2046) 2018-04-11 07:20:16 -07:00
Jelle Zijlstra
db989427cb dest argument to add_argument is Optional (#2040)
argparse.py checks for None in _get_optional_kwargs.
2018-04-10 21:47:30 -07:00
rchen152
e2cfc4bf0f Add private members to argparse.pyi. (#1937)
* Add _AttributeHolder and _ActionsContainer classes to argparse.

* Add Action subclasses to argparse.

* Add _UNRECOGNIZED_ARGS_ATTR, _ensure_value, _get_action_name to argparse.

* Fill in remaining _ActionsContainer attributes.

* Fill in missing argparse.ArgumentParser attributes.

* Fill in missing argparse.HelpFormatter attributes.

* Fill in remaining missing attributes on argparse classes.

* Rename TypeVar _ActionVar to _ActionT

* Add a version check for FileType attributes

* Add '# undocumented' where appropriate

* Add more # undocumented comments

* Make arguments to _ActionsContainer.add_argument more precise.
2018-04-10 20:56:49 -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
d43eac60dd add email.parser.FeedParser (#2028)
Fixes #1985.
2018-04-09 12:03:43 -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
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
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
Christopher Schramm
7f34bbcb88 Add pkgutil.ModuleInfo (#2010) 2018-04-04 15:15:43 -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
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
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