Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BEAM-7746] Silence a bunch of errors about "Cannot instantiate abstract class" #10591

Merged
merged 1 commit into from
Jan 30, 2020

Conversation

chadrik
Copy link
Contributor

@chadrik chadrik commented Jan 15, 2020

abc.ABCMeta has been removed from this class with a fixme (BEAM-2685), which
means there' no longer any runtime checking of @abc.abstractmethod. However,
mypy still performs abc.abtractmethod/property checks even if a class does
not use abc.ABCMeta (this is a feature that lets you avoid using metaclasses).

The problem arises because the beam code is doing a lot of dynamic patching of
to_runner_api_parameter (see register_pickle_urn), which mypy cannot track, so
it believes this method is missing.

We comment out @abc.abstractmethod, to disable the mypy checks (it's already
disabled at runtime by virtue of an earlier change to remove abc.ABCMeta).
We change the method to raise NotImplementedError to inform pylint not to trust
its return value (None) and to get some degree of runtime checking.

This is a followup to #9056.

R: @robertwb
R: @udim


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

Post-Commit Tests Status (on master branch)

Lang SDK Apex Dataflow Flink Gearpump Samza Spark
Go Build Status --- --- Build Status --- --- Build Status
Java Build Status Build Status Build Status Build Status
Build Status
Build Status
Build Status Build Status Build Status
Build Status
Build Status
Python Build Status
Build Status
Build Status
Build Status
--- Build Status
Build Status
Build Status
Build Status
--- --- Build Status
XLang --- --- --- Build Status --- --- ---

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website
Non-portable Build Status Build Status
Build Status
Build Status Build Status
Portable --- Build Status --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

@chadrik chadrik requested review from robertwb and udim January 15, 2020 23:17
…act class"

abc.ABCMeta has been removed from this class with a fixme (BEAM-2685), which
means there' no longer any runtime checking of @abc.abstractmethod. However,
mypy still performs abc.abtractmethod/property checks even if a class does
not use abc.ABCMeta (this is a feature that lets you avoid using metaclasses).

The problem arises because the beam code is doing a lot of dynamic patching of
to_runner_api_parameter (see register_pickle_urn), which mypy cannot track, so
it believes this method is missing.

We comment out @abc.abstractmethod, to disable the mypy checks (it's already
disabled at runtime by virtue of an earlier change to remove abc.ABCMeta).
We change the method to raise NotImplementedError to inform pylint not to trust
its return value (None) and to get some degree of runtime checking.
@chadrik
Copy link
Contributor Author

chadrik commented Jan 23, 2020

this should be ready to go.

@robertwb robertwb merged commit f7c2e6e into apache:master Jan 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants