Now that we're using Python 3.6+, we can start using inline type
I figured a good a place as any to start would be pycompat. So this
commit defines type annotations throughout the file.
Because we can't use deferred annotations parsing (since this feature
requires Python 3.7), complex types relying on symbols from the typing
module use quoted expressions. This achieves some of the benefit of
deferred parsing without compromising the ability for type checkers to
When annotating open() as part of this change, pytype started
complaining about a type mismatch in profiling.py. This turned out
to be a false positive. So the error was suppressed.
I think we should instead add an assert that self._fp is the right type, which would satisfy Pytype without disabling it and be more regression-proof.