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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions sdks/python/apache_beam/utils/urns.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

from __future__ import absolute_import

import abc
# TODO(BEAM-2685): Issue with dill + local classes + abc metaclass
# import abc
import inspect
from builtins import object
from typing import TYPE_CHECKING
Expand Down Expand Up @@ -68,14 +69,20 @@ class RunnerApiFn(object):

_known_urns = {} # type: Dict[str, Tuple[Optional[type], ConstructorFn]]

@abc.abstractmethod
# @abc.abstractmethod is disabled here to avoid an error with mypy. mypy
# performs abc.abtractmethod/property checks even if a class does
# not use abc.ABCMeta, however, functions like `register_pickle_urn`
# dynamically patch `to_runner_api_parameter`, which mypy cannot track, so
# mypy incorrectly infers that this method has not been overridden with a
# concrete implementation.
# @abc.abstractmethod
chadrik marked this conversation as resolved.
Show resolved Hide resolved
def to_runner_api_parameter(self, unused_context):
# type: (PipelineContext) -> Tuple[str, Any]
"""Returns the urn and payload for this Fn.

The returned urn(s) should be registered with `register_urn`.
"""
pass
raise NotImplementedError

@classmethod
@overload
Expand Down