Commit Graph
457 Commits
Author SHA1 Message Date
William AydandJelle Zijlstra bce70d1ca6 Added excepthandler to ast stubfiles (#2891) 2019-03-28 08:23:56 -07:00
Chen LiandSebastian Rittau 598d0d6ae1 [builtins] Add 'AST' type to 'source' parameter for 'compile()' (#2889) 2019-03-27 08:29:16 +01:00
Rebecca ChenandGitHub a1d1870779 Fix a py2 parameter type in string.Template.(safe_)substitute. (#2888)
Context: https://github.com/python/typeshed/pull/2871#issuecomment-476806895
2019-03-26 23:25:15 -07:00
Michael J. SullivanandGitHub c526975a1b Add overloads for min/max that don't take default (#2885)
PR #2833 introduced more flexible handling for the type of the default
parameter, but the extra type variable caused some issues. Add another
overload for the case where there is no default param.

This is I think related to the issues we have had with `get` recently?
2019-03-25 15:38:21 -07:00
wouter bolsterleeandSebastian Rittau afe665690c Add missing BaseException.__suppress_context__ attribute (#2876)
See also PEP 415: https://www.python.org/dev/peps/pep-0415/

Fixes #2875.
2019-03-16 22:16:01 +01:00
Rebecca ChenandSebastian Rittau e541cdd1a6 Add unicode support to py2 string.Template. (#2871) 2019-03-16 22:12:36 +01:00
Rebecca ChenandSebastian Rittau 03878d732a Add attribute queue.Queue.queue. (#2870) 2019-03-16 22:11:48 +01:00
Rebecca ChenandSebastian Rittau 8c252052f9 Move pydoc from 2/ to 2and3/. (#2873) 2019-03-16 09:37:24 +01:00
Sebastian RittauandJelle Zijlstra 26fefcc704 Use protocol for print() file argument (#2848)
Also, use object instead of Any for values list
2019-03-12 19:26:32 -07:00
Vasily ZakharovandSebastian Rittau e4e19d6e98 Add email.charset.SHORTEST, QP, BASE64 to the stub for Python 2 (#2857)
Also mark Python 3 constants as undocumented.

Fixes #2830
2019-03-11 20:41:19 +01:00
Vasily ZakharovandSebastian Rittau 08555f80d1 Make vars arguments Optional, as they default to None (#2853)
Closes #2847
2019-03-11 15:12:35 +01:00
Brandt BucherandJelle Zijlstra ab4c262043 Add isascii methods to str, bytes, and bytearray [Python 3.7]. (#2834) 2019-03-08 11:07:28 -08:00
herr kasteandSebastian Rittau 4dcd516caa Improve min/max (#2833)
* For min/max return Union type if default given
* For min/max mark keyword only arguments
* Also mark positional arguments
2019-03-08 19:25:34 +01:00
Michael J. SullivanandJelle Zijlstra 939be9a787 Make 2.7's json.load use a protocol for fp (#2826)
This matches what the 3 stub does
2019-03-05 12:14:00 -08:00
Maxim KurnikovandSebastian Rittau b80b2e4b98 make IMapIterator a subclass of Iterator (#2814) 2019-03-05 10:15:25 +01:00
Michael J. SullivanandGitHub f569957bbe Make urllib2.urlopen return a non-optional addinfourl (#2821)
This is technically wrong. The documentation states that:
"Note that None may be returned if no handler handles the request
(though the default installed global OpenerDirector uses
UnknownHandler to ensure this never happens)."

This is super marginal and making it optional causes a few dozen
errors in an internal dropbox code base.
2019-03-01 16:08:26 -08:00
Jelle ZijlstraandSebastian Rittau 14e387b6fd fix some minor lint errors (#2820)
Caught by a newer version of flake8
2019-03-01 12:29:23 +01:00
Ivan LevkivskyiandGitHub 3d638b0677 Revert "Fixing signature for Mapping.get's default parameter (#2810)" (#2817)
This reverts commit 3f83195558.
2019-02-27 18:09:46 +00:00
Mark MendozaandJelle Zijlstra 3f83195558 Fixing signature for Mapping.get's default parameter (#2810) 2019-02-22 21:20:02 -08:00
Philipp HahnandSebastian Rittau 25c96400f6 Add some urllib2 annotations (#2688) 2019-02-18 12:04:50 +01:00
Rebecca ChenandJelle Zijlstra d275e73e1f Remove pytype workaround in os/__init__.pyi. (#2797)
Pytype release 2019.02.13 fixed the bug that
necessitated this workaround.
2019-02-14 12:29:19 -08:00
Sebastian RittauandJelle Zijlstra 0989d9507e Fix groupby with key=None (#2794)
Cf #2790
2019-02-13 08:45:24 -08:00
Alun ChampionandSebastian Rittau 9b545a01ab Added Optional[] around the itertools.groupby() key attribute to allow None to pass the type (#2790)
Fixes #2788
2019-02-12 11:59:37 +01:00
Michael BrandtandSebastian Rittau 1442cc02bf Add stubs for HTTP Handler classes in py2/urllib2 & py3/urllib.request (#2710)
* HTTP Handler class annotations for py2/urllib2 & py3/urllib.request

Add full annotations for the following classes:

* Python 2:

    * `urllib2.AbstractHTTPHandler`
    * `urllib2.HTTPHandler`
    * `urllib2.HTTPsHandler`

* Python 3:

    * `urllib.request.AbstractHTTPHandler`
    * `urllib.request.HTTPHandler`
    * `urllib.request.HTTPsHandler`

This information is largely undocumented, and was obtained by directly examining
the Python source code:

* Python 2 (v2.7.15) - https://github.com/python/cpython/blob/v2.7.15/Lib/urllib2.py#L1115-L1243
* Python 3 (v3.7.1) - https://github.com/python/cpython/blob/v3.7.1/Lib/urllib/request.py#L1224-L1364

`urllib2.AbstractHTTPHandler.do_open` takes as a parameter either
`HTTPConnection` or `HTTPSConnection`--one of the classes, not an instance of
either--and constructs an object using only a few of the parameters that either
constructor could use. `HTTPConnectionProtocol` in `stdlib/2/httplib.pyi`
follows a similar patten to `HTTPConnectionProtocol` added to
`stdlib/3/http/client.pyi` in pull request #2582 to describe the type of the
`http_class` that is passed to `do_open`.
2019-02-11 11:25:02 +01:00
Łukasz HanuszczakandSebastian Rittau c8c6271365 Make NamedTuple accept Text names (#2762)
Closes #2761
2019-02-09 19:06:07 +01:00
Aymeric AugustinandSebastian Rittau f0c5ac04b0 Support *contiguous attributes of memoryview. (#2755) 2019-02-09 16:05:00 +01:00
Paul DagnelieandSebastian Rittau 5ef6cb7f46 Add types to some cross-platform functions in the platform library (#2781) 2019-02-08 20:28:53 +01:00
Michael J. SullivanandGitHub d8faf503ec Make SyntaxError.offset be optional (again) (#2782)
This was originally done in #2557, but got lost in #2533.
2019-02-08 11:09:18 -08:00
Joel RosdahlandSebastian Rittau 3eb66ba633 Add type annotation for collections.deque.__iadd__ (#2774)
* Add type annotation for collections.deque.__iadd__

Fixes #2771.
2019-02-01 19:39:09 +01:00
Utkarsh GuptaandSebastian Rittau ad803e1caa builtins.pyi: Update __iadd__() and imul() in class list (#2754)
Fixes #2711
2019-01-21 21:57:15 +01:00
Jelle ZijlstraandGitHub 78690405cf add back StopIteration.value in Python 3 (#2744)
Fixes python/mypy#6209.
2019-01-16 19:21:16 -08:00
VieldandSebastian Rittau ee20595996 Fix type of indent in JSONEncoder (#2737)
A None value for indent means the most compact representation (no newlines), it is also the default value.
2019-01-11 12:48:21 +01:00
Michael J. SullivanandGitHub c75d42ef23 Fix the type of ord on python 2 (#2735)
It looks like it got messed up in #2533
2019-01-10 19:24:51 -06:00
Sebastian RittauandJelle Zijlstra eb1788ac39 Merge Python 2 and 3 builtins.pyi (#2533) 2018-12-21 07:12:41 -08:00
Dave HalterandJelle Zijlstra 2cedbc7d63 Add missing attributes of type (#2544)
All these attributes can be seen when using `dir(type)`.

In the future we should be discussing if certain methods on object (like
__eq__) should really be there. IMO this should be defined on type where it
actually also appears when using `dir`.
2018-12-20 20:01:40 -08:00
Juan GonzalezandJelle Zijlstra c18b75b2e6 Make mypy aware of IMapUnorderedIterator (#2701) 2018-12-20 19:41:58 -08:00
Dave HalterandSebastian Rittau 5c69373890 macpath, os/path, posixpath and ntpath should basically be the same files (#2637) 2018-12-17 15:02:18 +01:00
Michael J. SullivanandSebastian Rittau 95afb86022 Move posix.stat_result to os.stat_result on python 3 (#2683)
In python 3, posix.stat_result is a re-export of os.stat_result, while
in python 2 it was the reverse. Update typeshed to reflect this.
2018-12-13 19:20:42 +01:00
Philipp HahnandSebastian Rittau d57e8c69f3 urllib2: timeout: int -> Optional[float] (#2685) 2018-12-12 15:47:53 +01:00
Guido van RossumandSebastian Rittau e08a5ac367 Tweak how ast.pyi imports typing (#2668)
When we import typeshed internally at Dropbox, somehow the fact that
these files are all stubs gets lost (it's a long story...).  This
causes errors like this:

  .../stdlib/2/ast.pyi:6: error: Name 'typing' already defined (by an import)

The quickest way around this is to rename the import to _typing.
2018-12-04 17:25:23 +01:00
Utkarsh GuptaandSebastian Rittau 3e4737c683 ast.pyi: Fix return type of generic_visit() (#2667)
Fixes #2085
2018-12-04 08:02:39 +01:00
Guido van RossumandGitHub de50614957 Stop inheriting Sized in collection ABCs (#2658)
Instead define abstract __len__ in affected classes.

Fixes #2655 without breaking
https://github.com/rominf/ordered-set-stubs/issues/1
2018-11-30 13:10:35 -08:00
Jukka LehtosaloandIvan Levkivskyi eaeb5fcf13 Revert "Move Sized earlier in the bases of Sequence (#2602)" (#2657)
This reverts commit 4dc21f04dd.

Fixes #2655.
2018-11-30 14:48:55 +00:00
Jukka LehtosaloandJelle Zijlstra 84548f5bba Revert "fix list concatenation (#2404)" (#2653)
The fix caused regressions for mypy that are difficult to
fix.  See https://github.com/python/mypy/issues/5492 for
context.

This reverts commit 1a42a2c3ea.
2018-11-29 12:20:29 -08:00
anentropicandSebastian Rittau 98e63d2d2f staticmethod and classmethod can wrap any callable (#2650)
Closes: #2645
2018-11-29 14:36:08 +01:00
Michael R. CrusoeandSebastian Rittau 48183b1d27 Unicode fixes for url2pathname() and pathname2url() (#2555) 2018-11-29 14:28:07 +01:00
Brandt BucherandJelle Zijlstra 1857435e6f types.CodeType.co_filename isn't Optional. (#2639) 2018-11-27 20:53:05 -08:00
Dave HalterandSebastian Rittau 84daf7c93b Add __getnewargs__ to float, int, bool, str, bytes, unicode (#2632) 2018-11-26 10:43:12 +01:00
Sebastian RittauandJelle Zijlstra 517d2b6012 Remove unneeded ignores (#2624) 2018-11-23 09:51:44 -08:00
Brandt BucherandSebastian Rittau 7685462672 Add complete annotations to builtins.compile. (#2606) 2018-11-20 17:48:24 +01:00