It should be possible to ask for every object whether it looks like
an element. If only Elements are accepted, this function would always
return True.
Fixes#2629
There does not seem to be an easy way to express that the array needs to be of a 1-byte type ('b', 'B', or 'c' in Python 2 only), so it is a bit more permissive than it should be.
* Allow only _CData subclasses as ctypes.Array elements
* Change type of ctypes.Array.raw and .value to Any (Closes#2111)
.raw and .value don't exist on all arrays. On c_char arrays, both exist
and have type bytes; on c_wchar arrays, only .value exists and has
type Text; on all other arrays neither one exists.
This is impossible to describe properly in a stub, so marking .value as
Any is the best that can be done.
This allows passing bytearray() objects to the base64 encode and decode functions, on both Python 2.7 and 3.4.
This also simplifies the code by ignoring 3.2 and 3.3, which are out of scope.
* Add FileWrapper protocol to wsgiref.types
* Annotate werkzeug's wrap_file and FileWrapper
* Remove empty line at end of file
* Fix _Readable protocols
Since Python 3.6 logging.FileHandler's filename argument can be a
PathLike object. Same for FileHandler's subclasses.
logging.basicConfig passes its filename argument to a FileHandler, so
this can be a PathLike object too.
Finally, logging.config.fileConfig passes its fname argument to
ConfigParser.read, which also takes a PathLike since version 3.6.1.
* optparse.Option.dest is a string
* optparse.OptionParser.epilog is a string
* optparse.OptionParser.prog is string
* optparse.OptionParser.values is Values
Shuffle code to resolve forward reference
* optparse.OptionParser.*option_list is a list of Options
* optparse.OptionParser.parse_args returns 2-tuple
<https://docs.python.org/2/library/optparse.html#parsing-arguments>
* minor improvements to Values
* Add ExcInfo and OptExcInfo type aliases
* Implement StartResponse using a protocol
* Mark stub-only types with an underscore
* Remove wrong TODO note
python/mypy#1178 is about variable-length tuples, while exc_info()
always returns a tuple with length 3. Ideally, exc_info() would
return Union[Tuple[Type[_E], _E, TracebackType], Tuple[None, None, None]],
but that is a different issue.
StartResponse callbacks are required to accept and optional third argument.
Currently, there is no good way to describe this using type hints.
Previously, a Union was used, but that causes mypy to complain about any call
of start_response().