Commit Graph
206 Commits
Author SHA1 Message Date
Jelle ZijlstraandŁukasz Langa 1515ed9f88 fix some abstract classes in third_party/ (#1486) 2017-07-19 20:27:22 +03:00
Ivan LevkivskyiandJelle Zijlstra d75ea88da5 Use 'as name' patter to re-export names from stubs (PEP 484) (#1484) 2017-07-14 21:31:53 -07:00
Jelle ZijlstraandMatthias Kramm 16aa0651ae Revert "Add __new__ to str and int stubs in both Pythons. (#1352)" (#1466)
This reverts commit fed4e03e53.
2017-07-06 14:21:54 -07:00
Roy WilliamsandJelle Zijlstra 7720a90bde Add stubs for pynamodb (#1431)
Approval here: https://github.com/pynamodb/PynamoDB/issues/209
2017-07-03 14:11:22 -07:00
Teemu RandJelle Zijlstra 218ce96871 PyYaml: uncomment commented out imports and add missing classmethod decorators (#1439)
* uncomment yaml imports

* yaml: decorate classmethods
2017-06-30 22:22:55 -07:00
Peter VilimandGuido van Rossum bc9b2f0d4d Fix signature for slite3.fetchmany (#1444)
Also made pymssql.fetchmany simpler.
2017-06-29 15:05:47 -07:00
Jukka LehtosaloandJelle Zijlstra 9b612c9218 Add TypedDict total argument (#1443)
See https://github.com/python/mypy/pull/3558 for context.
2017-06-29 08:38:13 -07:00
Max RozentsveygandJelle Zijlstra d3f9c55203 Add type stub for requests.packages.urllib3.util.connection.HAS_IPV6 (#1436)
This is defined at https://github.com/requests/requests/blob/v2.14.2/requests/packages/urllib3/util/connection.py#L130
2017-06-26 11:52:24 -07:00
Svyatoslav IlinskiyandJelle Zijlstra ee5e3affe1 Update Num stub for typed_ast 2.7 (#1430)
Field `n` should be a `Union[int, float, complex]`, not just `Union[int, float]`
2017-06-23 16:43:23 -07:00
Guido van RossumandMatthias Kramm 9238c737de Make HasField and ClearField use Text instead of str (#1425)
This allows one to write `x.HasField("ok")` even if the file has
`from __future__ import unicode_literals`"
2017-06-21 10:51:49 -07:00
Guido van RossumandMatthias Kramm 350563223f Add Optional[] for all remaining cases of x: <type> = None (#1424)
* Final round of adding Optional[] to type of arguments with default = None
* Update Travis to use --no-implicit-optionals and clarify CONTRIBUTING.md
2017-06-21 10:50:21 -07:00
Guido van RossumandGitHub 81f77b17ec Remove double Optional[] (#1423) 2017-06-21 09:54:40 -07:00
Guido van RossumandJelle Zijlstra 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 VarmaandGuido van Rossum b8b3146904 Add PyJWT type annotations (#1281) 2017-06-20 13:19:09 -07:00
Svyatoslav IlinskiyandMatthias Kramm 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 ProshevandJelle Zijlstra 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 GraingerandMatthias Kramm 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 KhomchenkoandMatthias Kramm 25b3a818d3 add required to click.option decorator (#1397) 2017-06-08 11:52:25 -07:00
Michael LeeandŁukasz Langa d25c5b9ce4 Move stubs for 'click' into 2and3 folder (#1364) 2017-06-02 11:01:24 -07:00
Yusuke MiyazakiandJelle Zijlstra 2b79108ddc Fix stub for ujson (#1374) 2017-05-30 23:20:40 -07:00
Jelle ZijlstraandGuido van Rossum 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 LeesandJelle Zijlstra 70363c27a7 Fix missed callback arguments to Click Decorators (#1327) 2017-05-23 21:22:25 -07:00
Cooper LeesandŁukasz Langa 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 MorehouseandGuido van Rossum 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
MaxandJelle Zijlstra 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 ZijlstraandMatthias Kramm 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-danandJelle Zijlstra 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 SeyferandJukka Lehtosalo c96a64d421 Remove second empty line in mypy_extensions (#1237) 2017-05-02 21:41:23 +01:00
Naomi SeyferandJukka Lehtosalo 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 ZijlstraandGuido van Rossum 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 ZijlstraandGuido van Rossum 1350d7e4d2 Fixes for datetime and relativedelta (#1191)
Fixes #1163.
2017-04-22 15:52:55 -07:00
David EurestiandJelle Zijlstra 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 LangaandJelle Zijlstra f543ddd89a Move yaml stubs to 2and3 (#1155) 2017-04-12 21:09:23 -07:00
Guido van RossumandJelle Zijlstra 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 ChaudharyandJelle Zijlstra 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-ClaudetandGuido van Rossum 138073922d Allow user-defined kwargs passed to click.group (#1092)
Fixes #1086
2017-03-29 10:20:41 -07:00
Guido van RossumandJelle Zijlstra 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 BallingerandGuido van Rossum 13bcc79c12 correct return value of Future.set_running_or_notify_cancel (#1078) 2017-03-22 16:59:07 -07:00
Jelle ZijlstraandGuido van Rossum 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 UrbanekandJelle Zijlstra 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 ZijlstraandŁukasz Langa 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 ProshevandŁukasz Langa 4cd137189a Remove object as the only ancestor for classes in Python 3 stubs. 2017-03-18 14:57:57 -07:00
Jelle ZijlstraandŁukasz Langa 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 ZijlstraandŁukasz Langa 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 HansenandGuido van Rossum 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 ZijlstraandGuido van Rossum f35f6860f3 add missing types to some arguments in third_party/3 (#994) 2017-03-14 08:12:14 -07:00
Antoine ReversatandGuido van Rossum 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 ZijlstraandGuido van Rossum eb07fd3c1a make sure typevars defined in stubs are private (#989)
And also a few type aliases I noticed in the process.

Found using https://github.com/JelleZijlstra/stublint/commit/59f9cac0951f431fbc3abf8803adeaac6e489aac
2017-03-13 07:32:40 -07:00
Hong MinheeandGuido van Rossum a6e3e70d14 Add incorrect/missing types to Werkzeug wrappers (#969) 2017-03-10 15:54:20 -08:00