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
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
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
Ł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
Nick Gaya
3e85d6bb61
Add missing unittest.mock.patch attributes ( #1882 )
2018-02-16 09:13:33 -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
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
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
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
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
Yuri Khan
732726400f
Add stub for stat.filemode ( #1837 )
...
Fixes #1836 .
2018-01-23 14:27:01 -08:00
Sebastian Rittau
7073bc0a49
Cleanup and merge datetime.pyi ( #1805 )
2018-01-09 22:06:31 +00:00
Jelle Zijlstra
2dd85c3658
move os.stat_result into posix stub ( #1818 )
...
This removes the circular dependency between the os and posix stub, which
is somehow triggering python/mypy#4442 . We should ideally fix the mypy bug,
but since it's easy enough to fix the import cycle, we might as well do that
too.
2018-01-09 13:50:56 -08:00
rchen152
f6b60cb3ea
A couple fixes to the io stubs. ( #1811 )
...
1. The 'name' argument to FileIO.init can be either a string or an integer: https://docs.python.org/2/library/io.html#io.FileIO
2. An mmap.mmap object can be used in most places that a bytearray can: https://docs.python.org/3.5/library/mmap.html
2018-01-04 16:14:38 -08:00
Jelle Zijlstra
4ee508a032
make os.scandir work as a context manager ( #1787 )
...
Rework of #1583 . Fixes #1573 .
See documentation in https://docs.python.org/3/library/os.html#os.scandir .
2018-01-02 10:17:38 -08:00
Anthony Sottile
03044212d4
Add typings for bool __{r,}{and,or,xor}__ ( #1795 )
2017-12-20 21:04:55 -08:00
Semyon Proshev
4b6b484786
Add clear method to MutableSequence in Python 3 ( #1765 )
2017-12-15 19:37:43 -08:00