Commit Graph
237 Commits
Author SHA1 Message Date
Jelle ZijlstraandMatthias Kramm 324f1761f4 Change more defaults to ... (#1727) 2017-11-09 10:32:17 -08:00
Jelle ZijlstraandMatthias Kramm 54dd6ba27c Change numerous default values to ... (#1722)
This is the convention, and some default values (e.g. strings) apparently
break pytype.
2017-11-09 06:28:40 -08:00
Brandon W MaisterandJelle Zijlstra a1238294d7 Remove unnecessary optionality for requests.Session (#1658)
Current code that initializes the things I've changed, to demonstrate that the
object is initialized this way:

* headers: https://github.com/requests/requests/blob/9713289e74/requests/sessions.py#L345
* proxies: https://github.com/requests/requests/blob/9713289e74/requests/sessions.py#L354
* hooks: https://github.com/requests/requests/blob/9713289e74/requests/sessions.py#L357
* params: https://github.com/requests/requests/blob/9713289e74/requests/sessions.py#L362
* cookies: https://github.com/requests/requests/blob/9713289e74/requests/sessions.py#L388

from what I can tell nothing in the official requests API ever creates a
session other than through `__init__`.
2017-11-08 19:53:56 -08:00
Grzegorz ŚliwińskiandJelle Zijlstra 9439ec4e4f click.echo message arg type to follow click's documentation (#1698)
str is not unicode on Python 2 while Text is a proper alias for unicode on python 2 and str on python 3

closes #1691
2017-11-08 19:41:36 -08:00
FichteFollandJelle Zijlstra f933b9384c Refine str.maketrans and str.translate (#1613)
str.translate requires a Mapping or Sequence (in essence, anything
with __getitem__), not a Dict.

str.maketrans in the one-argument form only converts character string
keys to their unicode ordinal, leaving any of the values untouched.
This mapping may use both integers or strings as keys at the same time.

str.maketrans in the multi-argument form returns a dict with any of the
values str, int or None, as recognized by str.translate.
2017-11-07 18:55:05 -08:00
Jelle ZijlstraandGuido van Rossum 735abe68dd remove all lxml stubs for now (#1664)
Fixes #525.
2017-11-07 07:54:01 -08:00
Grzegorz ŚliwińskiandJelle Zijlstra 81191e49a3 click.*option function parameter to accepts bool and Text (#1699)
This follows documentation and code which allows to use both bool and Text.
Update all the prompt arguments for all *option functions in click.decorators module
since they're mostly proxying the call to option setting desired defaults.

closes #1693
2017-11-03 22:52:12 -07:00
Patrick ValsecchiandJelle Zijlstra aafa556a10 Add context manager methods to requests.Response (#1701)
* Add context manager methods to requests.Response

* Simplified the requests.Response.__exit__ signature
2017-11-01 08:19:43 -07:00
Guido van RossumandGitHub 77c06d411c Remove type annotation from some Loader args (#1695)
There were two problems AFAICT:
- There are multiple Loader classes without a common base class,
  so this should really be a union or a protocol.
- The argument is supposed to be a class, not an instance.

Rather than figuring out a fix (which would probably require some
nasty refactoring) I'm just going back to the old situation where
these arguments are implicitly annotated with `Any`.

See also https://github.com/python/typeshed/pull/1657#pullrequestreview-72049880
2017-10-27 09:30:16 -07:00
Grzegorz ŚliwińskiandGuido van Rossum fcf1d38c57 fix typo in dateutil.tz importing tzutc as tzutz (#1694) 2017-10-27 07:40:16 -07:00
Ilya KonstantinovandJelle Zijlstra ab9733b448 Support for response hooks in requests (#1674) 2017-10-26 10:56:05 -04:00
Ilya KonstantinovandJelle Zijlstra 9a10c74345 requests.Session.headers and proxies not optional (#1676)
```
>>> import requests
>>> s = requests.session()
>>> s.headers
{'User-Agent': 'python-requests/2.18.4', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}
>>> s.proxies
{}
```
2017-10-25 16:50:59 -04:00
Guido van RossumandMatthias Kramm 994cfb5369 Make PY2 enum more like PY3 enum, fixing bug in unique() (#1668) 2017-10-25 09:47:45 -07:00
Wilfred HughesandMatthias Kramm 72e24b8443 Add basic type annotations for YAML load functions (#1657)
These are probably the most common YAML functions, so this should be useful even without type declarations on the rest of the package.
2017-10-20 10:18:47 -07:00
Ethan SmithandGuido van Rossum b7dc041f44 reexport names in 3/dateutil.tz (#1673)
This was missed in #1669, and should completely fix #1665.
2017-10-15 13:32:36 -07:00
Jelle ZijlstraandGuido van Rossum c10dc67ad2 Re-export names in dateutil.tz (#1669)
Fixes #1665.
2017-10-12 17:57:12 -07:00
rymdhundandJelle Zijlstra feac49ac7f requests.post data arg accepts an iterable of tuples (#1660) 2017-10-10 08:16:38 -07:00
Max RozentsveygandJelle Zijlstra 6a55ad5b60 Update stubs for pycurl (#1635) 2017-10-07 08:44:24 -07:00
Max RozentsveygandJelle Zijlstra c68dcf1870 Add definitions for boto/utils.py (#1579) 2017-10-04 21:44:10 -07:00
LloydandJelle Zijlstra 6c0fa96e4c Add pymysql.connections.Connection#begin(self) stub (#1636) 2017-10-03 12:05:51 -07:00
aubanelandJelle Zijlstra 666f71fb56 Add a few methods to Element and ElementTree (#1585) 2017-09-22 07:11:15 -07:00
Jonathan SchoonhovenandJelle Zijlstra dc46a435da allow all valid JSON in pynamodb JSONAttribute (#1604)
Currently, the type definition for `JSONAttribute` assumes the deserialized value will be a `dict`. However, a `list` is also a valid `JSONAttribute` (its [deserialize](https://github.com/pynamodb/PynamoDB/blob/495eae28679c781afc27f7d2d8c417e2302ed2a1/pynamodb/attributes.py#L418) method just calls `json.loads`.
2017-09-22 06:57:51 -07:00
Alex GrönholmandJelle Zijlstra 023afbc098 Fixed the signature of six.raise_from() (#1563)
* Made the from_value argument optional in raise_from()

* Fixed six.raise_from() from_value and return type for both py2 and py3
2017-08-26 14:43:43 -07:00
Tim CrawfordandJelle Zijlstra 341237339c requests: Add return type for __init__ methods (#1574) 2017-08-25 20:34:56 -07:00
Ivan LevkivskyiandŁukasz Langa 42e2142f28 Add Protocol and runtime to typing_extensions (#1564)
* Add Protocol and runtime to typing_extensions

* Use private type variable

* Fix typo

* Bound type variable for runtime to only class objects

* Conform to version check specification
2017-08-21 13:22:48 -07:00
Ashwini ChaudharyandJelle Zijlstra 46a73bb2e8 Added private method _basic_auth_str to stub for requests (#1514) 2017-08-11 17:11:28 -07:00
Zack HsiandJelle Zijlstra 6031b37be9 Add select_autoescape to jinja2 (#1530)
Fixes https://github.com/python/mypy/issues/3589.
2017-08-07 17:19:45 -06:00
Pavel PletenevandGuido van Rossum b2df503cde Add type annotations for emoji (#1506)
This adds type annotations for [`emoji` library](https://github.com/carpedm20/emoji/)
2017-08-03 16:12:50 -07:00
Svyatoslav IlinskiyandGuido van Rossum 7a580ed0a9 Re-export values for click library (#1516)
That way they can be used as
```
import click
click.<value>
```
2017-08-03 15:58:02 -07:00
Svyatoslav IlinskiyandGuido van Rossum 98d768b2c6 Re-export simplejson values (#1517) 2017-08-03 08:33:51 -07:00
Michael LeeandJelle Zijlstra 1e04a8c1b8 Add stubs for typing_extensions module (#1471) 2017-07-23 12:19:49 -07:00
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