Commit Graph

103 Commits

Author SHA1 Message Date
Dan Sully ef87943397 Update click.option to allow for user defined kwargs. (#1950)
Click's option decorator can take a cls= argument, which allows that class to parse arbitrary arguments from the decorator.
2018-03-07 10:32:55 -08:00
David Euresti df65f6ea15 Better type for click 'type' argument (#1903)
The call accepts tuples of types and callback methods
2018-03-06 21:41:21 -08:00
yed podtrzitko 1fe9fd83fa validator.instance_of can contain sequence of types (#1920) 2018-03-06 10:18:33 -08:00
David Euresti 50c7188300 Work around mypy issue #4554 in attr.Factory (#1933)
This makes the following not give a type error:

   y: DefaultDict[str, List[int]] = Factory(lambda: defaultdict(list))
2018-03-05 19:21:14 -08:00
Matthias Kramm 6c30806d07 add deprecation comment to mypy_extensions (#1943) 2018-03-05 18:51:14 -08:00
Han Song a5c9093edc Allow requests.post to accept str for data. (#1922)
```python
import json

url = 'https://api.github.com/some/endpoint'
payload = {'some': 'data'}
r = requests.post(url, data=json.dumps(payload))
```
2018-02-25 22:19:35 -08:00
David Euresti 61e63293f1 Work around mypy issue #4554 in attrs. (#1914) 2018-02-24 13:00:15 -08:00
Roy Williams 8891b02d51 Make update parameters all optional (#1913)
As of https://github.com/pynamodb/PynamoDB/pull/352 all of these params are optional.
2018-02-23 13:18:55 -08:00
Daniel Bowman 1707d8f466 Improve pymysql types (#1804)
Add all cursor types and missing show_warnings method in connections

Added show_warnings to connections. No return type specified as this
requires tracing back through missing return types in previous
author's work. This is out of scope for this pull request.

Added SSDictCursor, SSCursor and DictCursorMixin to complete the
Cursors definition.
2018-02-16 17:23:17 -08:00
Asim Goheer e7b567c1f4 Issue 1858: pynamodb 3.2.1 added new methods in Attributes which are not in typeshed (#1859) 2018-02-16 16:54:45 -08:00
Roy Williams 0f36f7ea09 Treat all pynamodb Numbers as floats (#1895)
Previously we specified this as a Union type, which caused more problems than it helped with, namely when reading data off a Pynamo property
We still had to cast to the appropriate type.  Pynamo simply reads the type out of Dynamo, which more closely models a float as it can be an int or a float -

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html
2018-02-16 16:42:32 -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
Chad Dombrova b111a4537f Add attrs library (#1838) 2018-02-02 21:26:35 -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
Carl Meyer 1c3ec74d13 Remove incomplete thrift stubs that cause false positives. (#1827) 2018-01-26 15:26:14 -08:00
Garrett 372b541a07 Fix requests session hooks type (#1794) 2018-01-26 14:39:01 -08:00
Roy Williams 8175130688 Reexport DoesNotExist from pynamodb.models (#1809) 2018-01-10 05:00:39 +08:00
Jelle Zijlstra 0eb7083f0e move dateutil into 2and3 (#1743)
These stubs are identical since #1735.
2017-12-23 06:38:55 -08:00
Sebastian Rittau 64ca731d0b jinja2: Add Template.environment (#1789)
From the docstring for Template: "Template objects created from the
constructor rather than an environment do have an `environment`
attribute that points to a temporary environment ..."
2017-12-17 10:04:53 -08:00
Alex Dehnert 8404a62231 requests: add more accurate stubs for certain fields of the Session object (#1504)
* requests: allow strings in Session.verify

Per the documentation[1] (and actual usage), the verify parameter can be a
string or a bool.

[1] http://docs.python-requests.org/en/master/user/advanced/#ssl-cert-verification

* requests: explicitly support AuthBase for Session.auth

According to the documentation, the auth parameter should be an AuthBase
subclass[1].  In practice, the actual requirement seems to just be a
Callable[[Request], Request], and AuthBase implements that with the __call__
method. However, mypy isn't currently smart enough to infer that __call__
implies Callable[2]. In the interim (and perhaps also to add clearer errors),
explicitly support AuthBase.

Additionally, this adds typing of AuthBase.__call__, to match the
Callable[[Request], Request] declaration used elsewhere.

[1] http://docs.python-requests.org/en/master/user/advanced/#custom-authentication
[2] https://github.com/python/mypy/issues/797
2017-12-14 21:05:28 -08:00
Roy Williams 1dccd1fdc4 Allow requests.post to accept Dict[str, str] for data. (#1777)
* Allow `requests.post` to accept `Dict[str, str]` for `data`.

For example:

```python
import requests
requests.post('https://www.foo.bar', data={'hello': 'world'})
```

Failes to type check in Python 2 even though it's fine.

* Explode str/Text combinations

* Fix lint

* Simplify iterable parameter for data
2017-12-14 20:36:21 -08:00
Alan Du 7c4765357a Make requests.Response.iter_content allow None (#1784)
* Make requests.Response.iter_content allow None

According to the docstring:
> chunk_size must be of type int or None

* Combine and alphabetize import statement
2017-12-13 14:25:32 -08:00
Roy Williams 10a76c1fdd Export Connection and TableConnection from pynamodb.connection (#1779)
It looks like in recent versions of mypy this stopped being exported.
2017-12-07 14:35:13 -08:00
Guido van Rossum 821c765991 Several packages always auto-import certain submodules on import (#1752)
* Importing yaml implies yaml.resolver

* Importing six implies six.moves

* Importing requests implies requests.packages
2017-11-17 15:15:40 -08:00
Jelle Zijlstra 533a05be45 Fix some of the last default values that are not ... (#1731)
* still one left in atomicwrites that I need to investigate further
* fix atomicwrites
2017-11-13 07:08:30 -08:00
Jelle Zijlstra 69bffd154a Fix default values in click stubs to ... (#1734) 2017-11-13 07:07:20 -08:00
Jelle Zijlstra 84d0cbf776 move thrift to 2and3 (#1736)
thrift supports Python 3 as of version 0.10.0. These stubs are pure stubgen and
might not be much good, but they belong in 2and3.
2017-11-13 07:05:57 -08:00
Jelle Zijlstra bcfd3bf554 Fill out croniter stubs and move to 2and3 (#1737)
* fill out croniter stub
* move to 2and3
2017-11-13 07:05:38 -08:00
Jelle Zijlstra 83ca997140 Change more defaults to ... (#1729)
* codemod ': Any = None' ': Any = ...'
* codemod ': (Union|Optional)([^=]+)\s+=\s+-?\d+' ': \1\2 = ...'
* codemod ': (Union|Optional)([^=]+)\s*=\s*-?(None|False|True)' ': \1\2 = ...'
* codemod ': (int|float|bool)\s*=\s*-?\d+' ': \1 = ...'
* codemod ': (bool)\s*=\s*(False|True)' ': \1 = ...'
* codemod ': Any\s*=\s*(False|True|None)' ': Any = ...'
2017-11-13 06:56:24 -08:00
Jelle Zijlstra 324f1761f4 Change more defaults to ... (#1727) 2017-11-09 10:32:17 -08:00
Jelle Zijlstra 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 Maister 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ński 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
FichteFoll 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
Grzegorz Śliwiński 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 Valsecchi 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 Rossum 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
Ilya Konstantinov ab9733b448 Support for response hooks in requests (#1674) 2017-10-26 10:56:05 -04:00
Ilya Konstantinov 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
Wilfred Hughes 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
rymdhund feac49ac7f requests.post data arg accepts an iterable of tuples (#1660) 2017-10-10 08:16:38 -07:00
Max Rozentsveyg c68dcf1870 Add definitions for boto/utils.py (#1579) 2017-10-04 21:44:10 -07:00
Lloyd 6c0fa96e4c Add pymysql.connections.Connection#begin(self) stub (#1636) 2017-10-03 12:05:51 -07:00
Jonathan Schoonhoven 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
Tim Crawford 341237339c requests: Add return type for __init__ methods (#1574) 2017-08-25 20:34:56 -07:00
Ivan Levkivskyi 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 Chaudhary 46a73bb2e8 Added private method _basic_auth_str to stub for requests (#1514) 2017-08-11 17:11:28 -07:00
Zack Hsi 6031b37be9 Add select_autoescape to jinja2 (#1530)
Fixes https://github.com/python/mypy/issues/3589.
2017-08-07 17:19:45 -06:00
Pavel Pletenev 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 Ilinskiy 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