Fixes#975
And a few more things I noticed while reading the tempfile docs.
In 3.5, most functions in tempfile were changed to accept either str or bytes in their prefix and suffix arguments, and return bytes or str accordingly. This seemed like a case for AnyStr.
We were missing tempdirb and tempprefixb, added in 3.5.
TemporaryFile and others were declared as returning BinaryIO, but they actually return either binary or text IO depending on the mode passed in. I changed the return type to IO[Any], similar to builtins.open.
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.)