robertwb commented on a change in pull request #14390:
URL: https://github.com/apache/beam/pull/14390#discussion_r616044888
##########
File path: sdks/python/apache_beam/transforms/environments.py
##########
@@ -109,12 +113,25 @@ class Environment(object):
_urn_to_env_cls = {} # type: Dict[str, type]
def __init__(self,
- capabilities, # type: Iterable[str]
- artifacts, # type:
Iterable[beam_runner_api_pb2.ArtifactInformation]
- ):
+ capabilities, # type: Iterable[str]
+ artifacts, # type: Iterable[beam_runner_api_pb2.ArtifactInformation]
+ resource_hints, # type: Optional[Mapping[str, bytes]]
+ ):
# type: (...) -> None
self._capabilities = capabilities
self._artifacts = artifacts
+ self._resource_hints = dict(resource_hints) if resource_hints else {}
+
+ def __eq__(self, other):
+ return (
+ self.__class__ == other.__class__
Review comment:
The danger here is that a subclass forgets to override `__eq__` and this
gets uses rather than, say, an error that equality is not implemented.
(Subclasses and comparisons are generally a messy business.)
It does look like you've provided proper overrides everywhere.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]