Correctly detects calls to `register()` with a function of incompatible return
type. Correctly recognizes the `register()`, `dispatch()`, and
`_clear_cache()` methods on a generic function, as well as the `registry`
mapping.
Possible future improvements: it would be amazing if `register()` checked if
the first argument of the registered callable is indeed of valid type. This
would require Callable[] to support varargs. It would also be great if we
could read the arguments of the remaining arguments during `@singledispatch()`
and cross-check them during `register()` with the currently registered
implementation. Again, this would require Callable[] to become much more
advanced.
I added strong types to the class that users are likely to interact with and left
the rest untyped for now. This is needed to support Flask.
Permission is given here - https://github.com/pallets/flask/issues/2012
I'm preparing a PR to mypy that further formalizes and improves the rules for
which functions are "compatible" with each other, both for subtyping and for
assignment. This is the one place in the stubs that violates the new rules but
not the old: the supertype `Serializer` can take an optional positional argument
called `serializer` to `load_payload`, but until this diff the mixin used to
implement it could not, but rather could only take `serializer` as a named
argument, through its **kwargs.
python/mypy#2380 showed a discrepancy between object and FunctionType in stdlib2. The first defined __doc__ to be str, the second Optional[str]. As FunctionType depends on object, this is no longer valid.
As suggested by @gvanrossum in python/mypy#2380, all __doc__ should be considered Optional.
(Final verdict was just to remove most __doc__ attributes since it's inherited from object.)
The ujson module apparently will accept both bytes and text format
input, however, it does always output a str (both on Python 2 and
Python 3).
Some discussion in: https://github.com/python/typeshed/pull/460
* Add more specific types for requests.sessions.Session
Once this is accepted I'd like to propegate these signatures to all of the
convience methods people actually use like get, post, put, etc...
* s/Optional[Union,/Union[None,/g
typing.AnyStr usage here was a mistake that I noticed too late,
from a GitHub comment[1]:
AnyStr is a type variable so in your version of
objectify.fromstring() the types if text and base_url have to
correspond -- but with unions they can each be either str or bytes,
and that's how the rest of the API is defined.
[1] https://github.com/python/typeshed/pull/436#issuecomment-237708512
* Add pytz basic typing
* Add pytz.lazy basic typing
* Move the files to the correct path
* Move files to correct directory
* Ignore issue with different sig from supertype
Add types to pkg_resources, mostly rewrote it based on the documentation.
Also remove pkg_resources._vendor which generated by stubgen but was implementation specific.
* Fix stubs for 2.7/dateutil. They were pretty broken.
(The 3/dateutil share some of the brokenness but that's still a TODO.)
* Fix argparse stubs.
- Container is not strong enough for choices.
- add_subparsers() returns something with an add_parser() method.