Fixes#1940.
This makes it so that mypy will infer the common base class of these
classes to be Awaitable instead of Iterable. I verified that this
fixes the errors in the script posted by @neilconway.
The annotations, formatarg, formatvarargs, formatvarkw, formatvalue,
formatreturns, and formatannotations arguments to inspect.formatargspec
have default values, but they cannot be None.
This module is going to be used by mypy for the daemon on Windows. To that end I ran stubgen on _winapi, then read through Modules/_winapi.c to add the function types. This seems to have been added in Python 3.1, but I think it is completely fine to just leave it in stdlib/3.
* add inspect.{isasyncgenfunction,isasyncgen} (3.6)
* reorder inspect.CO_* as in Python 3.6 doc
* add inspect.CO_{COROUTINE,ITERABLE_COROUTINE} (3.5)
* add inspect.CO_ASYNC_GENERATOR (3.6)
* use variable annotations
* use version checks
* Parameter.empty is a class attribute
* Signature.empty is a class attribute
The Python 2 version was slightly outdated compared to the Python 3
version.
The Python 2 version of Headers.__delitem__() had an optional argument
_index_operation that also exists in the implementation. But considering
this is internal use only, it was missing from the Python 3 version, and
it created problems with derived classes, I decided not to add it to
the merged stub. See also pallets/werkzeug#1051.
* fix type for TestCase.assertIn
This does essentially `assert member in container`, so we want a `Container`, not an `Iterable`.
This came up in 68e9d426a8..0bbee43d60 (r192525658).
* use any for assertIn
The type signature of get_grouped_opcodes() was incorrect. Resulting in type errors when checking return values.
The usage of this function is like this:
groups = sm.get_grouped_opcodes() # groups is Iterable[List[Tuple[str, int, int, int, int]]]
for group in groups: # group is List[Tuple[str, int, int, int, int]]
for opcode in group: # opcode is Tuple[str, int, int, int, int]
* Move google protobuf from 2 to 2and3
This should generally be ok. I ran the internal consistency
tests and they seemed to pass.
* Convert str to bytes
* repr to use str in google.protobuf.internal.containers
The dict stub was referring to an instance, not the type, leading to
__call__ being considered when using as a decorator, rather than
__init__.
mock is a backport of the stdlib module and should be defined the same.
Fixes#2124.
As mentioned in the issue, the current guidelines lead to extremely long lines of many hundreds of characters, which make code hard to read and review. I think there should be some limit to line length, but it's OK for stubs to have somewhat longer lines than normal code.
For reference, there are currently 115 lines in typeshed over 200 characters; 523 over 120 characters; and 2980 over 79 characters.
We picked 130 because that's the longest line GitHub displays on a 13" laptop in a unified diff without folding. There are currently 382 lines in typeshed that are over 130 characters.
* Add OpenDirector.addheaders and replace type comments with annotations
* Use ClassVar/eliminate `= ...` and add BaseHandler.handler_order (exists in Py2 versions)