Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BEAM-7746] Add python type hints (part 1) (apache#9915)
* Address issues with a few missing modules/objects * Ignore some objects missing from typeshed * Ignore an issue regarding asymmetrical property getter/setter * Ignore unavoidable errors Many of these (those marked with [misc]) are due to mypy taking issue with: - the use of invalid type objects (typehints not typing) - the use of type objects at runtime * Ignore some conditional imports in tests * Ignore functions missing from typeshed * Add tests for Timestamp/Duration comparisons * Ignore errors about dynamic base classes This problem will be fixed when the next version of mypy is released * Ignore some monkey-patching for tests * Consolidate python build requirements This resolves a pip conflict that was happening between setupVirtualenv task and the tox task by ensuring that everything agrees on the same set of versions. * Ignore a difficult scenario where None is sometimes unsafe `None` is only safe to pass as the context to Coder.to_runner_api() when we know that the Coder class does not have components, otherwise the context is used to find and convert them. We could remove the need for special case `ignores` by reorganizing our Coder class hierarchy to add a CompoundCoder base class or mixin. Right now this is the only place in the code that we need to ignore this problem, so it's not worth tackling now. * Add a mypy lint job The test runs but error status is ignored. * Workaround a bug in pylint pylint-dev/pylint#3217 * Add type annotations to bulk of python codebase There are no meaningful runtime changes in this commit. * Silence errors about overriding methods. This seems to be fine to do on an instance as long as the types match, but not on a class. * Address review notes * Rebase fixup
- Loading branch information