In python 3, add an overload for there being no digits argument
and make it return int.
In python 2, __round__ doesn't exist and SupportsRound doesn't exist
in the typing module. Use SupportsFloat for python 2 round().
Remove decimal's __round__ overload that takes None, since it doesn't exist
PR #2833 introduced more flexible handling for the type of the default
parameter, but the extra type variable caused some issues. Add another
overload for the case where there is no default param.
This is I think related to the issues we have had with `get` recently?
This is technically wrong. The documentation states that:
"Note that None may be returned if no handler handles the request
(though the default installed global OpenerDirector uses
UnknownHandler to ensure this never happens)."
This is super marginal and making it optional causes a few dozen
errors in an internal dropbox code base.
* HTTP Handler class annotations for py2/urllib2 & py3/urllib.request
Add full annotations for the following classes:
* Python 2:
* `urllib2.AbstractHTTPHandler`
* `urllib2.HTTPHandler`
* `urllib2.HTTPsHandler`
* Python 3:
* `urllib.request.AbstractHTTPHandler`
* `urllib.request.HTTPHandler`
* `urllib.request.HTTPsHandler`
This information is largely undocumented, and was obtained by directly examining
the Python source code:
* Python 2 (v2.7.15) - https://github.com/python/cpython/blob/v2.7.15/Lib/urllib2.py#L1115-L1243
* Python 3 (v3.7.1) - https://github.com/python/cpython/blob/v3.7.1/Lib/urllib/request.py#L1224-L1364
`urllib2.AbstractHTTPHandler.do_open` takes as a parameter either
`HTTPConnection` or `HTTPSConnection`--one of the classes, not an instance of
either--and constructs an object using only a few of the parameters that either
constructor could use. `HTTPConnectionProtocol` in `stdlib/2/httplib.pyi`
follows a similar patten to `HTTPConnectionProtocol` added to
`stdlib/3/http/client.pyi` in pull request #2582 to describe the type of the
`http_class` that is passed to `do_open`.
All these attributes can be seen when using `dir(type)`.
In the future we should be discussing if certain methods on object (like
__eq__) should really be there. IMO this should be defined on type where it
actually also appears when using `dir`.