This adds a few stubs that are used by absl-py, and, without them, cause
type checker errors under Pytype:
* TestCase._formatMessage
* TestCase._testMethodName
* TestCase._getAssertEqualityFunc
* TestProgram.runTests
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.
Based on the pytz docs http://pytz.sourceforge.net/ and code (version
2018.5).
- Accurately model the return value of the `timezone()` function. This
necessitates modeling the internal pytz class hierarchy which is quite
inconsistent.
- Expose `_BaseTzInfo` as `BaseTzInfo`.
This change is useful because this type is importable and otherwise
there is no pytz type which can be used in type annotations, e.g. in a
function which takes a pytz `tzinfo` with the `localize` method,
rather than a general `datetime.tzinfo`.
- Remove the lazy.pyi stubs. The `lazy` module contains some unrelated
general data structures. It is not a public API - it is not documented
and the types are not included in `__all__`.
- Remove methods which are already specified by inheritance in
`datetime.tzinfo`.
- Add several public exception classes.
- Fill in the generic type parameters of the exposed `Dict`/`List`
constants. Also change `Dict` -> `Mapping` because it is not actually
a proper `dict`.
- Some style/ordering improvements.
* Moves the pytype installation to requirements-tests-py3.txt, now
that pytype can run under Python 3.5+.
* Changes tests/pytype_test.py to not require a --python{version}-exe
argument when it can automatically find the Python interpreter, and
cleans up a few typos and out-of-date things.
* Updates the appropriate documentation.
* Updates .travis.yml.
The __new__ method should suffice, and having both interferes with providing
a __new__ in namedtuples, which we want to do to fix
https://github.com/python/mypy/issues/1279.
Previously, constructing a TimeoutExpired directly worked because Exception allowed arbitrary kwargs. We fixed that recently, but now mypy gives an error on creating a TimeoutExpired with legal arguments.