Commit Graph

1575 Commits

Author SHA1 Message Date
Rob Day
f91163d729 Fix type of loop parameter to start_unix_server (#1939) 2018-03-03 13:34:02 -08:00
Miguel Gaiowski
a8465da863 Add stub for subprocess.list2cmdline function (#1898) 2018-03-02 11:04:22 -08:00
Kenny Do
156927d2a2 tzinfo.tzname is optional (#1934) 2018-02-28 19:14:12 -08:00
Takuya Akiba
74345aa898 Add missing next method to iterators returned by Pool.imap (#1926) 2018-02-28 18:34:30 -08:00
Takuya Akiba
7e169a29c2 Add multiprocessing.pool to Python 2 stub (#1932) 2018-02-28 11:22:11 -08:00
rchen152
e1243d0103 Add missing attributes, fix some parameter types in argparse.Action. (#1907) 2018-02-28 11:20:04 -08:00
Roy Williams
a618ee30d4 Fix instantiating a xml.etree.ElementTree.Element (#1930)
The methods removed by https://github.com/python/typeshed/pull/1816
are abstract in `MutableSequence` and therefore must be specified on `Element`.
2018-02-27 14:59:11 -08:00
Josh Holland
c9eead5890 Make some arguments in secrets module optional (#1929) 2018-02-27 10:52:21 -08:00
Takuya Akiba
5e37071a42 Fix imports to expose error classes in multiprocessing module (#1928) 2018-02-27 09:47:18 -08:00
rchen152
066c434410 Improve the unittest stubs. (#1927)
* Improvements to stdlib/2/unittest.pyi

* Adds a bunch of missing things.
* Fixes the signatures of assertRaises and failUnlessRaises.
* Corrects the name of a TestCase subclass from CallableTestCase
  to FunctionTestCase.
* Makes defaultTestLoader an instance of TestLoader, as it should
  be, rather than an alias. Based on https://docs.python.org/2/library/unittest.html and
  https://github.com/python/cpython/tree/2.7/Lib/unittest.

* Improvements to stdlib/3/unittest/__init__.pyi

* The constructor arguments to TextTestResult are all required.
* There is a module-level load_tests() function.
* removeResult() returns a bool. Based on https://docs.python.org/3/library/unittest.html and
  https://github.com/python/cpython/tree/master/Lib/unittest.
2018-02-27 06:46:10 -08:00
Łukasz Langa
9b6df1d6bc [tokenize.open] Accept PathLike filename (#1921)
* [tokenize.open] Accept PathLike filename

* Still accept str, bytes and int on Python 3.6+
2018-02-26 11:01:48 -08:00
Sebastian Rittau
38aea73b4b Merge Python 2 and 3 versions of time.pyi (#1909)
* Use variable annotations
* Replace default values by ellipses
* Remove exceptions from function bodies
* Remove superfluous comments
* Remove superfluous newlines
* Use Optional instead of Union[..., None]
* Replace Union[int, float] by just float

* Make time.pyi (Python 2) more closely resemble the Python 3 stub

* Replace _TIME_TUPLE by TimeTuple
* Reorder imports

* time.pyi: Mark two arguments as optional, mark Unix-only function

* time.pyi (Python 2): Use TimeTuple in NamedTuple and reformat

This makes time.pyi more closely match the Python3 version.

* Merge Python 2 and 3 versions of time.pyi

* Only import SimpleNamespace on Python >= 3.3

* Remove default values from module properties

* Remove Optional from strftime() and asctime()

* accept2dyear was removed in Python 3.3

* Rename TimeTuple to _TimeTuple
2018-02-24 11:49:37 -08:00
Jelle Zijlstra
35d3effe03 Remove version check for deque.insert and deque.index (#1916)
Otherwise, deque is not instantiable in Python 3.4. We could do a dynamic base class instead
but that doesn't seem worth it.
2018-02-24 11:12:56 -08:00
Jason Fried
f5b3979b70 contextlib.pyi ExitStack.callback take Callable (#1908)
* contextlib.pyi ExitStack.callback take Callable

The documentation for ExitStack does not specify the return type of the callable's passed to callback.  
Saying that they always return None breaks a very common use case for ExitStack, which is to "schedule" changes to a collection 
while iterating it.  

```
with ExitStack() as stack:
    for key, value in adict.items():
        if ...:
            stack.callback(adict.pop, key)
```

I also added AsyncExitStack, using Awaitable.

* Moving to Explicit Any in Generics
2018-02-24 09:41:13 -08:00
Ethan Smith
f91c891ad4 Fix name collision in contextlib on 3.7 (#1915) 2018-02-24 09:25:47 -08:00
Daniel Li
84b6e95bdc Accept unicode in importlib.import_module (#1910)
On Python 2, importlib.import_module accepts bytes or unicode.
2018-02-22 09:05:06 -08:00
Daniel Li
2c6296034f Future.set_running_or_notify_cancel returns bool (#1911)
Future.set_running_or_notify_cancel returns a bool, not None. See commit
13bcc79c12, where this problem was fixed
for Python 2.
2018-02-22 09:03:37 -08:00
Ivan Levkivskyi
7ae2f25216 Fix some problems introduced by recent commits. (#1905) 2018-02-20 13:34:48 -08:00
shahin
d3a9650fa1 Fix return type of re.match, re.search (#1886) 2018-02-19 09:23:57 -08:00
David Euresti
8ecb74012a Add __divmod__ to numeric types (#1900)
Helps with #1889
2018-02-18 16:59:12 -08:00
Pradyun Gedam
b6bd58268b Update base class to match the source file (#1899) 2018-02-18 09:03:09 -08:00
Mark Amery
0c2249fbd6 Add FileHandler properties (#1834)
Fixes #1833.
2018-02-16 17:21:30 -08:00
Ilya Kulakov
1e8b953182 Add stub for AsyncExitContext added by bpo-29302. (#1876)
* Add stub for AsyncExitContext added by bpo-29302.

* ExitStack's pop_all returns an instance of type(self).
2018-02-16 17:17:17 -08:00
Łukasz Langa
18ae67d040 [stdlib/3/multiprocessing] Add queues.pyi, make the other stubs use it (#1879) 2018-02-16 17:00:44 -08:00
Roy Williams
71c2a94cb8 Allow os.listdir to accept a PathLike in Python3.6 (#1894) 2018-02-16 16:42:58 -08:00
Guido van Rossum
37ec012113 Change the type of BaseException.message to Any (#1887) 2018-02-16 13:42:28 -08:00
Guido van Rossum
100a071729 Make the urllib.quote/unquote functions generic (#1891)
When given unicode they will return unicode.
Also make 'safe' Text.
Fixes #1893.
2018-02-16 13:14:05 -08:00
Nick Gaya
3e85d6bb61 Add missing unittest.mock.patch attributes (#1882) 2018-02-16 09:13:33 -08:00
Łukasz Langa
2e278f2aeb [stdlib/2and3/__future__] Add PEP 563 annotations (#1880) 2018-02-14 09:23:17 -08:00
Marti Raudsepp
d288f443b9 Merge {IO,Environment,Windows}Error into OSError for Python 3.3+ (#1852)
Starting with Python 3.3, IOError, EnvironmentError and WindowsError are
aliases for OSError, which has all the attributes.

Reference:
* https://docs.python.org/3/library/exceptions.html#OSError
* https://www.python.org/dev/peps/pep-3151/

* OSError: Drop Python <3.3 compatibility
* Use Any instead of Union for filename/filename2 type, per GvR comment
See: https://github.com/python/mypy/pull/4541
2018-02-14 16:33:56 +00:00
rchen152
8d46ada49d Add undocumented but occasionally used attributes to inspect.pyi. (#1864)
* Add attributes not in docs to 2/inspect.pyi.
* Add attributes not in docs to 3/inspect.pyi.
* Change list to List[Any] in 2/inspect.pyi
2018-02-14 16:20:55 +00:00
Salvo 'LtWorf' Tomaselli
b33c7d1a84 Add missing private field to NamedTuple (#1866)
It is very useful for doing introspection.
2018-02-14 16:11:19 +00:00
NODA, Kai
3c4bc4266d improve asyncio.AbstractEventLoop.getaddrinfo() (#1867)
The signature should match that of socket.getaddrinfo()
2018-02-14 16:09:38 +00:00
Jelle Zijlstra
fe4bea39a2 fix return type of linecache.getlines (#1877)
Randomly noticed this looking at the stub. Here is the code: https://github.com/python/cpython/blob/3.7/Lib/linecache.py#L37.
2018-02-13 16:19:44 -08:00
Matt Bogosian
afc84c119c Add TestCase.longMessage to stdlib/2/unittest.pyi (#1875)
Fixes #1874.
2018-02-11 16:16:35 -08:00
Karl Ramm
c5bb3aa547 mypy gets confused if you leave out 'self' (#1871) 2018-02-10 13:24:05 -08:00
Rhys Parry
6b82088e20 Add UserDict attribute data for Python 3 (#1863) 2018-02-09 07:55:58 -08:00
Chad Dombrova
ed9d08e93b Collections that inherit from dict should should override copy() (#1856)
Solves issue #1642. A previous attempt at this, #1656,
added __copy__ but omitted copy, and it did not properly use self-type.
2018-02-09 00:26:37 +00:00
Matthias Kramm
9c04490e92 add sys.setdefaultencoding() (#1865) 2018-02-08 11:25:48 -08:00
Rick Kilgore
1713ad64de allow Optional[float] for asyncio.wait() timeout arg (#1860) 2018-02-07 19:49:33 -08:00
George King
1533602779 filter function: make the callable of the first overload non-optional so that mypy is able to select the second overload for the case. (#1855) 2018-02-05 10:50:40 -08:00
Guido van Rossum
fa98de6d57 Accept Text in distutils *Version classes (#1854) 2018-02-05 10:50:04 -08:00
PeterJCLaw
10b14c654c Add type stub for the lzma module (#1844)
* Add type stub for the lzma module

* Claim to extend BinaryIO to resolve test failures

This doesn't record the true hierarchy of the type, though avoids
errors from mypy that 'Argument 1 of "read" incompatible with
supertype "BufferedIOBase"'.
2018-02-01 14:36:42 -08:00
Marti Raudsepp
15f07f5d03 Add ImportError attributes name, path for Python 3.3+ (#1849)
Reference: https://docs.python.org/3/library/exceptions.html#ImportError
2018-02-01 07:38:26 -08:00
Semyon Proshev
3e00a8f8e1 PEP 553 and PEP 564 (#1846)
* Add `breakpoint` to builtins (PEP 553)

* Add new `time` functions (PEP 564)
2018-01-31 16:51:25 -08:00
James M. Allen
33039f913e Adding py36 additions to datetime module (#1848) 2018-01-31 16:22:25 -08:00
gossrock
79e0b94ef1 adding curses.ascii, curses.panel and curses.textpad modules (#1792)
* adding ascii, panal and textpad modules to the curses module.

* added curses/panel.pyi and curses/textpad.pyi to test/pytype_blacklist.txt
just like curses/__init__.pyi because they all import _curses. (This
may not be the right thing to do)
2018-01-26 14:39:55 -08:00
Sebastian Rittau
6d7173b70b Add StringIO.name and BytesIO.name (#1802)
Also, change the type of StringIO.name (Python 3) from str to Any.

Neither StringIO nor BytesIO actually define a name field, but the
super-class IO[T] of both in typeshed does define a read-only property.
This means that sub-classes of StringIO and BytesIO adding this field
will not typecheck correctly.

Closes: #1790
2018-01-26 14:34:06 -08:00
rchen152
66e5863ead Change the return type of unittest.TestCase.fail() to NoReturn (#1843)
* Change the return type of unittest.TestCase.fail() to NoReturn

* Import mypy_extensions.NoReturn instead of typing.NoReturn
2018-01-26 14:28:37 -08:00
Yuri Khan
468d2fa629 _curses.tparm works on bytes, not str (#1828)
The documentation refers to the first argument as `str`
but careful reading reveals that its type,
and the function return type, is `bytes`.
2018-01-23 14:31:59 -08:00