Commit Graph

2017 Commits

Author SHA1 Message Date
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
David Euresti
fe5e12795f Fix signature of CaseInsensitiveDict (#1873)
The values can be more than just strings.
2018-02-11 08:19:39 -08:00
Karl Ramm
c5bb3aa547 mypy gets confused if you leave out 'self' (#1871) 2018-02-10 13:24:05 -08:00
Can Berk Güder
c1c9fac63f Add tornado.process (#1870) 2018-02-09 15:43:22 -08:00
Guido van Rossum
40d6faeccd Ignore thrift imports (#1869)
Fixes #1868
2018-02-09 09:11:59 -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
Martin DeMello
60dc2e2408 Clean up the pytype blacklist. (#1851) 2018-02-06 15:41:47 -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
Chad Dombrova
b111a4537f Add attrs library (#1838) 2018-02-02 21:26:35 -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
Erwin Janssen
b5baedffb7 Add 'message' to click.decorators.version_option (#1845)
Click's version_option decorator allows the caller to specify the
version message. This optional string option is missing in typeshed.
2018-01-31 16:56:49 -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
Carl Meyer
1c3ec74d13 Remove incomplete thrift stubs that cause false positives. (#1827) 2018-01-26 15:26:14 -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
Garrett
372b541a07 Fix requests session hooks type (#1794) 2018-01-26 14:39:01 -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
Sebastian Rittau
a08d57833f Fix werkzeug environ type (#1831)
* Fix werkzeug environ type

PEP 3333 explicitly calls for environ to be a built-in dict. Using a
Mapping will not only prevent the dict from being modified (which is
explicitly allowed by PEP 3333), it will also cause interaction
problems when the environment is passed to other WSGI handlers.

Also change the value type from object to Any for convenience. By
definition, the values can be anything and can't be type checked.
Using object instead of Any forces us to explicitly cast the value
whenever we access it.

* Use Union[str, unicode] for Werkzeug environment keys

This matches the type in wsgiref.types.

* Use WSGIEnvironment from wsgiref.types

* Add '= ...' to environ attribute
2018-01-26 14:30:23 -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
Michael Lee
1e4c2a9031 Refine types for distutils.version (#1835)
Note: these type signatures were derived mainly by looking at the
docstrings inside distutils.version. For reference:

- py3 impl: https://github.com/python/cpython/blob/master/Lib/distutils/version.py
- py2 impl: https://github.com/python/cpython/blob/2.7/Lib/distutils/version.py
2018-01-23 14:29:22 -08:00
Yuri Khan
732726400f Add stub for stat.filemode (#1837)
Fixes #1836.
2018-01-23 14:27:01 -08:00
Martin DeMello
754789b031 modify pytype_test to run from within pytype too, and support python3 (#1817) 2018-01-22 12:18:58 -08:00
Ivan Levkivskyi
c2fa0a153a Minor improvements to simplejson stubs (#1832)
This fixes signatures of `load` and `loads` and cleans-up
`JSONDecodeError`.
2018-01-19 22:42:31 +00:00
David Zbarsky
7f3e01550b Add py2 stubs for multiprocessing.Queue (#1829)
This is basically the same API as in Python 3.
2018-01-18 00:06:15 +00:00
Sebastian Rittau
35edccce68 CONTRIBUTING: Use PEP 526 syntax in example (#1803)
* Add an example property, whitespace for grouping
* No default values from module-level constants
* Document that PEP 526 syntax is preferred
2018-01-17 10:28:45 -08:00
Elliott Beach
f207bc3cc3 add note about not squashing (#1830) 2018-01-16 16:26:48 -08:00
Matthias Kramm
72052d8338 Fix tests to work with newest version of pytype (#1824) 2018-01-12 12:28:19 -08:00
Michel Albert
5264fa6d5d Fix return-type of _BaseNetwork.supernet() (#1822)
The return type is currently defined as iterator, while it in fact returns a
network instance.
2018-01-11 08:24:11 -08:00
Nathan Henrie
9429ac070b Use Union[bytes, Text] instead of AnyStr (#1819) 2018-01-11 08:23:39 -08:00
rchen152
76c733dc5b Fix the return type of os.popen() (#1820) 2018-01-10 05:57:29 -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
Roy Williams
8175130688 Reexport DoesNotExist from pynamodb.models (#1809) 2018-01-10 05:00:39 +08:00
Elliott Beach
688f813457 fix subclassing ExitStack (#1810) 2018-01-08 06:02:30 -08:00
rchen152
db6e2a637b Fix some bugs in xml.etree.ElementTree.Element's container behavior. (#1816)
* Have Element inherit from MutableSequence, which is more precise than Sequence.
* Remove unnecessary inherited methods (e.g., __getitem__).
* Correct extend() to take an Iterable. (Sequence was too specific.)
* Alphabetize the typing imports, for sanity.
2018-01-04 19:04:46 -08:00
rchen152
29acda6431 Add itertools.imap signatures for more than two iterables. (#1815) 2018-01-04 19:03:41 -08:00