Commit Graph

194 Commits

Author SHA1 Message Date
Guido van Rossum
04fe184dcf Add flags to pass on --warn-unused-ignores and --no-implicit-optional to mypy (#1421)
* Add flags to pass on --warn-unused-ignores and --no-implicit-optional to mypy
* Make implicit Optional explicit in arg types (2and3 part)
* Convert {stdlib,third_party}/2 to explicit Optional
2017-06-20 22:18:49 -07:00
Atul Varma
b8b3146904 Add PyJWT type annotations (#1281) 2017-06-20 13:19:09 -07:00
Svyatoslav Ilinskiy
d5eb32d67e Support iteration over enums with enum34 (#1412)
* Support iteration over enums in python 2

* fix lint
2017-06-19 06:39:56 -07:00
Semyon Proshev
fed4e03e53 Add __new__ to str and int stubs in both Pythons. (#1352)
* Update default values to `...` in `__init__` and `__new__` in `int` and `str`.
* Add `__new__` to `enum.IntEnum` to override inherited `__new__`.
* Add `type: ignore` comment to `IntEnum`
2017-06-12 20:53:32 -07:00
Thomas Grainger
55f1883928 requests.(post|put|patch) json kwarg should be Any. (#1387)
```python
>>> requests.post('https://httpbin.org/post', json=["ham", "spam", {"eggs": "bacon"}]).json()
{'args': {}, 'data': '["ham", "spam", {"eggs": "bacon"}]', 'files': {}, 'form': {}, 'headers': {'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate', 'Connection': 'close', 'Content-Length': '34', 'Content-Type': 'application/json', 'Host': 'httpbin.org', 'User-Agent': 'python-requests/2.17.3'}, 'json': ['ham', 'spam', {'eggs': 'bacon'}], 'origin': '82.70.100.78', 'url': 'https://httpbin.org/post'}
>>> requests.post('https://httpbin.org/post', json=("ham", "spam", {"eggs": "bacon"})).json()
{'args': {}, 'data': '["ham", "spam", {"eggs": "bacon"}]', 'files': {}, 'form': {}, 'headers': {'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate', 'Connection': 'close', 'Content-Length': '34', 'Content-Type': 'application/json', 'Host': 'httpbin.org', 'User-Agent': 'python-requests/2.17.3'}, 'json': ['ham', 'spam', {'eggs': 'bacon'}], 'origin': '82.70.100.78', 'url': 'https://httpbin.org/post'}
```
2017-06-08 11:53:26 -07:00
Alex Khomchenko
25b3a818d3 add required to click.option decorator (#1397) 2017-06-08 11:52:25 -07:00
Michael Lee
d25c5b9ce4 Move stubs for 'click' into 2and3 folder (#1364) 2017-06-02 11:01:24 -07:00
Yusuke Miyazaki
2b79108ddc Fix stub for ujson (#1374) 2017-05-30 23:20:40 -07:00
Jelle Zijlstra
4f2dd0f446 remove unused type ignore flags (#1346)
Verified that none of those are necessary for pytype.
2017-05-26 08:28:51 -07:00
Cooper Lees
70363c27a7 Fix missed callback arguments to Click Decorators (#1327) 2017-05-23 21:22:25 -07:00
Cooper Lees
df657161f0 Tweak Click 6.6 Decorator Type Stubs (#1244)
* Tweak Click 6.6 Decorator Type Stubs
- Add context_settings for command
- Make callback Callable type accept some more types

To address Issue 1238

* Update decorators.pyi
2017-05-23 14:01:49 -07:00
Emily Morehouse
b6d08b81a3 #1286 Remove header comments from stubs (#1292)
- Updates documentation related to previously required comment headers.
- Removes all comment headers from stubs
- Occasionally included a header for stubs that were noted to be incomplete or contained todo's.
2017-05-22 15:14:15 -07:00
Max
df9df65882 More precise signatures in concurrent.futures (#1262)
* Allow None in concurrent.futures.exception() and set_exception()

* Make Executor.map() signature more precise

* Remove superfluous signatures

* Specify str type for some concurrent.futures constants

* Update concurrent.futures backport

* CR fixes
2017-05-14 13:55:27 -07:00
Jelle Zijlstra
7dd2f80194 Fixes to ContextManager (#1249)
* add typing.ContextManager for 3.6+ only

This fixes the easier part of #655.

Would it make sense to add a generic typing.ContextManager that exists in any Python version?

* update comment

* fix argument types for ContextManager.__exit__

* add AsyncContextManager

* add @asynccontextmanager

* typing.ContextManager now always exists

* back out async-related changes

Will submit those in a separate PR later

* fix import order

* AbstractContextManager only exists in 3.6+

* AbstractContextManager -> ContextManager
2017-05-08 16:21:51 -07:00
li-dan
e080d8ea77 Add missing methods to Python 2 concurrent.futures (#1236)
* Add missing methods to Python 2 concurrent.futures

Future.exception_info() and Future.set_exception_info() are methods
present only in the Python 2 backport of concurrent.futures.

* Mark timeout args as optional
2017-05-04 08:24:50 -07:00
Naomi Seyfer
c96a64d421 Remove second empty line in mypy_extensions (#1237) 2017-05-02 21:41:23 +01:00
Naomi Seyfer
6a9d74d1c7 Args for "flexible callable" experimental mypy feature. (#793)
This is the typeshed for the constructors for the Arg types that we'll now be
able to pass to Callable.  They really just return their type arguments.
2017-05-02 21:40:41 +01:00
Jelle Zijlstra
b9e896d97c make type aliases in lxml.etree private (#1216)
Naming the alias "AnyStr" isn't a great idea since AnyStr normally means
the typevar.

Also removed some whitespace in accordance with typeshed style.
2017-04-30 09:36:37 -07:00
Jelle Zijlstra
1350d7e4d2 Fixes for datetime and relativedelta (#1191)
Fixes #1163.
2017-04-22 15:52:55 -07:00
David Euresti
759da86478 Cleanup six.moves module (#1180)
* Cleanup six.moves

Regenerate files so all imports are present, comment out imports that fail.
Remove useless files.

* Fix flake8
2017-04-21 16:03:19 -07:00
Łukasz Langa
f543ddd89a Move yaml stubs to 2and3 (#1155) 2017-04-12 21:09:23 -07:00
Guido van Rossum
3594b0e607 Fix JSONWebSignatureSerializer.load_dangerous() signature to satisfy mypy. (#1135)
The latest mypy complained that the signature didn't match that in the
superclass: Serializer.load_payload() has a serializer argument.  I
don't know this project but I think it's best to just add that
argument (rather than adding `# type: ignore`).
2017-04-04 09:51:56 -07:00
Ashwini Chaudhary
35b6795183 Stubs for boto.kms (#1081)
* Stubs for boto.kms

* Added types for params

* Added return type and fixed signatures(including review changes)

* Removed make_request from stub(https://github.com/python/mypy/issues/1237). Fixed Dict issue.

* Fixed typo

* Let's be precise about return type
2017-04-03 21:22:32 -07:00
Bertrand Bonnefoy-Claudet
138073922d Allow user-defined kwargs passed to click.group (#1092)
Fixes #1086
2017-03-29 10:20:41 -07:00
Guido van Rossum
03bfcee0b8 Remove sqlalchemy. (#1105)
See discussion in https://github.com/python/typeshed/pull/1094.

If we do this we should make it easier in mypy to install 3rd party stubs that are used by default.
2017-03-28 08:25:00 -07:00
Thomas Ballinger
13bcc79c12 correct return value of Future.set_running_or_notify_cancel (#1078) 2017-03-22 16:59:07 -07:00
Jelle Zijlstra
8318953a17 remove if TYPE_CHECKING in sqlalchemy stub (#1074)
This isn't needed in typeshed, since the stubs aren't executed.
2017-03-22 08:02:38 -07:00
Stefan Urbanek
5b47bc956e Added SQLAlchemy annotations (#1029)
* Added SQLAlchemy annotations

* Made Connection and Engine sublcasses of Connectable (python/typeshed#1018)
* Moved execute() from Connection to Connectable
* Made RowProxy a Mapping and removed Mapping inherited methods
* Made ResultProxy an Iterator of RowProxy
* Added most relevant methods for fetching of ResultProxy
* Added where(), group_by(), order_by() and limit() to Select

* Follow squalchemy module structure

* Created sqlalchemy.engine.result and moved ResultProxy and RowProxy
  there
* Created sqlalchemy.engine.interfaces and moved Connectable there
* Added non-deprecated methods to Connectable: connect,
  contextual_connect and scalar
* Fixed return type of scalar() to Any

* Missed ResultProxy scalar return

... had it in Connectable only.
2017-03-21 23:11:41 -07:00
Jelle Zijlstra
37a854630c merge 2 and 3 stubs for requests (#1017)
* merge 2 and 3 stubs for requests

* fix version comparison
2017-03-18 16:39:40 -07:00
Semyon Proshev
4cd137189a Remove object as the only ancestor for classes in Python 3 stubs. 2017-03-18 14:57:57 -07:00
Jelle Zijlstra
97e1ffff40 Modify the Python 3 stubs for requests to be Python 2-compatible
This works towards fixing #924. To make the changes easier to review, I'm planning to
fix the issue in two steps:
- This commit makes the 3 stubs compatible with py2
- The next PR will move the 3 stubs to 2and3 and remove the 2 stubs

I wrote this code by diffing the files in third_party/{2,3}/requests and making
appropriate changes to the Python 3 stubs (mostly str/Text stuff). I verified
that the 3 stubs now pass mypy when parsed as 2.7, but I don't have an annotated
requests-using codebase to test on.
2017-03-17 10:27:47 -07:00
Jelle Zijlstra
349ff59f33 change empty bodies from "pass" to "..."
CONTRIBUTING.md says to prefer ... Not the most impactful change but fixing
these will allow us to lint for it in the future and get a consistent style.
2017-03-16 09:13:08 -07:00
Richard Hansen
1abd14bbcd Allow old-style exception types for backported Future. (#946)
third_party/2/concurrent/futures is for the Python 2 backport of the
concurrent.futures package from Python 3.  In Python 3, all exceptions
are derived from BaseException, but Python 2 also supports exceptions
that are old-style objects (which don't derive from BaseException).
Switch from BaseException to Any to allow old-style exceptions.

All old-style objects are instances of types.InstanceType, so an
alternative to Any is Union[BaseException, types.InstanceType].  This
would help avoid accidentally passing a non-BaseException new-style
object to Future.set_exception().  However, only Executors call that
function (usually), and it's not clear that mypy understands old-style
objects and their relationship to types.InstanceType, so Any is
thought to be the more practical choice.
2017-03-14 09:35:06 -07:00
Łukasz Langa
05cba488a5 Revert "Fix click annotation syntax and add missing keyword arguments to subprocess (new in 3.76) (#999)"
This reverts commit 43a1f761b2.
2017-03-14 08:13:14 -07:00
Jelle Zijlstra
f35f6860f3 add missing types to some arguments in third_party/3 (#994) 2017-03-14 08:12:14 -07:00
Antoine Reversat
43a1f761b2 Fix click annotation syntax and add missing keyword arguments to subprocess (new in 3.76) (#999)
* Fix click annotations

* Add encoding and errors keyword arguments (new in 3.6)
2017-03-14 08:02:12 -07:00
Jelle Zijlstra
eb07fd3c1a make sure typevars defined in stubs are private (#989)
And also a few type aliases I noticed in the process.

Found using 59f9cac095
2017-03-13 07:32:40 -07:00
Hong Minhee
a6e3e70d14 Add incorrect/missing types to Werkzeug wrappers (#969) 2017-03-10 15:54:20 -08:00
Nikhil Marathe
8e59579953 concurrent.futures: Add various Errors. Fix wait(). (#964)
Introduces Error, CancelledError and TimeoutError, based on the backport.
Also fixes the return type of wait to be Sets instead of Iterables. The
function documentation promises Sets and the code uses Sets.

https://github.com/agronholm/pythonfutures/blob/master/concurrent/futures/_base.py#L261
2017-03-07 16:39:25 -08:00
David Fisher
6e34fc9127 Remove semicolon in type (#976) 2017-03-07 14:33:55 -08:00
Samuel Colvin
0cb247e96f correct version_option arguments in click (#966) 2017-03-03 11:16:13 -08:00
Ivan Levkivskyi
10c5e0cb44 Fix build following mypy support for metaclasses (#952)
Mypy now supports metaclasses in Python 2, see python/mypy#2830
so that now __metaclass__ attribute has special treatment.

This PR makes small changes to fix the build (also most PRs are red because of this)
2017-02-22 12:39:57 +00:00
David Euresti
8d42a2899a Add configparser and builtins to six (#937)
* Add configparser and builtins to six

* Use 'as' import
2017-02-20 11:38:49 -08:00
Tim Abbott
e3831d8d80 jinja2: Add InternationalizationExtension elements. (#942)
Fixes #927.
2017-02-20 11:09:44 -08:00
Richard Hansen
55d4c08a8e Use BaseException for Future.exception() and .set_exception(). (#935)
The concurrent.futures.Future class's set_exception() method might be
called with a BaseException that is not an Exception, so change
set_exception()'s parameter type from Exception to BaseException.  The
exception set via set_exception() is returned by exception(), so
change exception()'s return type from Exception to BaseException.
2017-02-15 08:19:49 -08:00
Guido van Rossum
43d7747f59 Add missing List imports to dateutil package. (#934) 2017-02-14 11:59:19 -08:00
Ivan Levkivskyi
22c0353498 Add missing imports from typing (#933) 2017-02-14 10:59:00 -08:00
David Fisher
52dd4903d1 Update typed_ast for version 1.0 (#931) 2017-02-13 07:26:45 -08:00
Adam Marszałek
ca36070d51 Improved pytz support for timezone function (#911) 2017-02-03 10:54:59 -08:00
Lucas Wiman
0d1015f00b Update type of six.string_types to Union[str, unicode] (#882) 2017-01-30 07:41:19 -08:00