* Fix werkzeug environ type
PEP 3333 explicitly calls for environ to be a built-in dict. Using a
Mapping will not only prevent the dict from being modified (which is
explicitly allowed by PEP 3333), it will also cause interaction
problems when the environment is passed to other WSGI handlers.
Also change the value type from object to Any for convenience. By
definition, the values can be anything and can't be type checked.
Using object instead of Any forces us to explicitly cast the value
whenever we access it.
* Use Union[str, unicode] for Werkzeug environment keys
This matches the type in wsgiref.types.
* Use WSGIEnvironment from wsgiref.types
* Add '= ...' to environ attribute
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 ..."
* 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
* 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
* 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
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.
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
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
Currently, the type definition for `JSONAttribute` assumes the deserialized value will be a `dict`. However, a `list` is also a valid `JSONAttribute` (its [deserialize](495eae2867/pynamodb/attributes.py (L418)) method just calls `json.loads`.
* 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