In Python 3:
- The `mmap` type is `Iterable[int]`, not `Iterable[bytes]`.
- The `read_byte` method returns an `int`, and the `write_byte` method only accepts an `int` as its first and only argument.
- The `__setitem__` method accepts any `ReadableBuffer` object, not just `bytes`.
In both Python 2 and 3:
- The `__delitem__` method always raises a `TypeError`, so the proper return type is `NoReturn`.
- The `mmap` type isn't generic, so I've simplified the stubs by removing the unnecessary `_mmap` class.
As brought up in https://github.com/python/typeshed/pull/5516
Alternatives include:
- Use another type var that has a value restriction
- Doing something fancy with Protocols that have a __bool__ that returns
a Literal (which may not work)
- Doing nothing
* Replace all uses of StrPath, BytesPath, and AnyPath in Python 2 stubs.
* Add StrOrBytesPath as preferred alias for AnyPath.
* Replace all remaining AnyPath instances with StrOrBytesPath.
* Mark AnyPath as obsolete.
Part of #5470
* run script and do some manual changes (Akuli)
* do the whole thing manually (srittau)
* merge changes (Akuli)
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
* Split cgi.pyi into Py2 and 3 versions
* Restore correct Python 2 version of cgi.pyi
* Remove unnecessary version checks in cgi.pyi
* Use collections.abc
* Use List in Python 2 stub