This is an automated email from the ASF dual-hosted git repository.
tvalentyn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new e67ba2b [BEAM-5949] Remove trivial __ne__ implementations. (#13887)
e67ba2b is described below
commit e67ba2bdeb34b477e18dfad05b2e883837e0432c
Author: tvalentyn <[email protected]>
AuthorDate: Thu Mar 18 13:56:10 2021 -0700
[BEAM-5949] Remove trivial __ne__ implementations. (#13887)
---
sdks/python/apache_beam/coders/coders.py | 4 ----
sdks/python/apache_beam/coders/coders_test.py | 4 ----
sdks/python/apache_beam/coders/typecoders_test.py | 4 ----
sdks/python/apache_beam/dataframe/expressions.py | 3 ---
sdks/python/apache_beam/dataframe/partitionings.py | 9 --------
sdks/python/apache_beam/internal/metrics/cells.py | 8 --------
sdks/python/apache_beam/internal/util.py | 4 ----
sdks/python/apache_beam/io/concat_source_test.py | 4 ----
sdks/python/apache_beam/io/filebasedsink.py | 4 ----
sdks/python/apache_beam/io/filesystem.py | 4 ----
sdks/python/apache_beam/io/gcp/pubsub.py | 4 ----
.../python/apache_beam/io/hadoopfilesystem_test.py | 4 ----
sdks/python/apache_beam/io/restriction_trackers.py | 4 ----
sdks/python/apache_beam/metrics/cells.py | 20 ------------------
sdks/python/apache_beam/metrics/execution.py | 11 ----------
sdks/python/apache_beam/metrics/metricbase.py | 4 ----
sdks/python/apache_beam/options/value_provider.py | 4 ----
sdks/python/apache_beam/pvalue.py | 7 -------
sdks/python/apache_beam/runners/common.py | 8 --------
sdks/python/apache_beam/testing/test_stream.py | 4 ----
sdks/python/apache_beam/testing/util.py | 4 ----
sdks/python/apache_beam/transforms/core.py | 8 --------
sdks/python/apache_beam/transforms/cy_combiners.py | 4 ----
sdks/python/apache_beam/transforms/display.py | 4 ----
sdks/python/apache_beam/transforms/environments.py | 24 ----------------------
sdks/python/apache_beam/transforms/trigger.py | 8 --------
sdks/python/apache_beam/transforms/window.py | 18 ----------------
sdks/python/apache_beam/typehints/decorators.py | 3 ---
sdks/python/apache_beam/typehints/row_type.py | 4 ----
.../apache_beam/typehints/trivial_inference.py | 8 --------
sdks/python/apache_beam/typehints/typehints.py | 4 ----
sdks/python/apache_beam/utils/timestamp.py | 11 ----------
sdks/python/apache_beam/utils/windowed_value.py | 11 ----------
33 files changed, 229 deletions(-)
diff --git a/sdks/python/apache_beam/coders/coders.py
b/sdks/python/apache_beam/coders/coders.py
index 2085564..d8029c9 100644
--- a/sdks/python/apache_beam/coders/coders.py
+++ b/sdks/python/apache_beam/coders/coders.py
@@ -291,10 +291,6 @@ class Coder(object):
# pylint: enable=protected-access
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return hash(type(self))
diff --git a/sdks/python/apache_beam/coders/coders_test.py
b/sdks/python/apache_beam/coders/coders_test.py
index 02e996e..4c479fe 100644
--- a/sdks/python/apache_beam/coders/coders_test.py
+++ b/sdks/python/apache_beam/coders/coders_test.py
@@ -165,10 +165,6 @@ class DummyClass(object):
return True
return False
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return hash(type(self))
diff --git a/sdks/python/apache_beam/coders/typecoders_test.py
b/sdks/python/apache_beam/coders/typecoders_test.py
index dd2156a..5a5c037 100644
--- a/sdks/python/apache_beam/coders/typecoders_test.py
+++ b/sdks/python/apache_beam/coders/typecoders_test.py
@@ -35,10 +35,6 @@ class CustomClass(object):
def __eq__(self, other):
return self.number == other.number
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return self.number
diff --git a/sdks/python/apache_beam/dataframe/expressions.py
b/sdks/python/apache_beam/dataframe/expressions.py
index ba081ca..80ee149 100644
--- a/sdks/python/apache_beam/dataframe/expressions.py
+++ b/sdks/python/apache_beam/dataframe/expressions.py
@@ -223,9 +223,6 @@ class Expression(object):
def __eq__(self, other):
return self._id == other._id
- def __ne__(self, other):
- return not self == other
-
def __repr__(self):
return '%s[%s]' % (self.__class__.__name__, self._id)
diff --git a/sdks/python/apache_beam/dataframe/partitionings.py
b/sdks/python/apache_beam/dataframe/partitionings.py
index 769025f..ef58023 100644
--- a/sdks/python/apache_beam/dataframe/partitionings.py
+++ b/sdks/python/apache_beam/dataframe/partitionings.py
@@ -86,9 +86,6 @@ class Index(Partitioning):
def __eq__(self, other):
return type(self) == type(other) and self._levels == other._levels
- def __ne__(self, other):
- return not self == other
-
def __hash__(self):
if self._levels:
return hash(tuple(sorted(self._levels)))
@@ -157,9 +154,6 @@ class Singleton(Partitioning):
def __eq__(self, other):
return type(self) == type(other)
- def __ne__(self, other):
- return not self == other
-
def __hash__(self):
return hash(type(self))
@@ -179,9 +173,6 @@ class Arbitrary(Partitioning):
def __eq__(self, other):
return type(self) == type(other)
- def __ne__(self, other):
- return not self == other
-
def __hash__(self):
return hash(type(self))
diff --git a/sdks/python/apache_beam/internal/metrics/cells.py
b/sdks/python/apache_beam/internal/metrics/cells.py
index 44ee395..2b12760 100644
--- a/sdks/python/apache_beam/internal/metrics/cells.py
+++ b/sdks/python/apache_beam/internal/metrics/cells.py
@@ -109,10 +109,6 @@ class HistogramResult(object):
def __hash__(self):
return hash(self.data)
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __repr__(self):
return '<HistogramResult({})>'.format(
self.data.histogram.get_percentile_info())
@@ -147,10 +143,6 @@ class HistogramData(object):
def __hash__(self):
return hash(self.histogram)
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __repr__(self):
return 'HistogramData({})'.format(self.histogram.get_percentile_info())
diff --git a/sdks/python/apache_beam/internal/util.py
b/sdks/python/apache_beam/internal/util.py
index da90d81..e95c30e 100644
--- a/sdks/python/apache_beam/internal/util.py
+++ b/sdks/python/apache_beam/internal/util.py
@@ -65,10 +65,6 @@ class ArgumentPlaceholder(object):
"""
return isinstance(other, ArgumentPlaceholder)
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return hash(type(self))
diff --git a/sdks/python/apache_beam/io/concat_source_test.py
b/sdks/python/apache_beam/io/concat_source_test.py
index 622e8e9..0d2c7b9 100644
--- a/sdks/python/apache_beam/io/concat_source_test.py
+++ b/sdks/python/apache_beam/io/concat_source_test.py
@@ -87,10 +87,6 @@ class RangeSource(iobase.BoundedSource):
type(self) == type(other) and self._start == other._start and
self._end == other._end and self._split_freq == other._split_freq)
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
class ConcatSourceTest(unittest.TestCase):
def test_range_source(self):
diff --git a/sdks/python/apache_beam/io/filebasedsink.py
b/sdks/python/apache_beam/io/filebasedsink.py
index a355d8c..083f158 100644
--- a/sdks/python/apache_beam/io/filebasedsink.py
+++ b/sdks/python/apache_beam/io/filebasedsink.py
@@ -403,10 +403,6 @@ class FileBasedSink(iobase.Sink):
# pylint: disable=unidiomatic-typecheck
return type(self) == type(other) and self.__dict__ == other.__dict__
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
class FileBasedSinkWriter(iobase.Writer):
"""The writer for FileBasedSink.
diff --git a/sdks/python/apache_beam/io/filesystem.py
b/sdks/python/apache_beam/io/filesystem.py
index c57f133..702dfaa 100644
--- a/sdks/python/apache_beam/io/filesystem.py
+++ b/sdks/python/apache_beam/io/filesystem.py
@@ -452,10 +452,6 @@ class FileMetadata(object):
def __hash__(self):
return hash((self.path, self.size_in_bytes))
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __repr__(self):
return 'FileMetadata(%s, %s)' % (self.path, self.size_in_bytes)
diff --git a/sdks/python/apache_beam/io/gcp/pubsub.py
b/sdks/python/apache_beam/io/gcp/pubsub.py
index 586f98e..b6711c9 100644
--- a/sdks/python/apache_beam/io/gcp/pubsub.py
+++ b/sdks/python/apache_beam/io/gcp/pubsub.py
@@ -89,10 +89,6 @@ class PubsubMessage(object):
return isinstance(other, PubsubMessage) and (
self.data == other.data and self.attributes == other.attributes)
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __repr__(self):
return 'PubsubMessage(%s, %s)' % (self.data, self.attributes)
diff --git a/sdks/python/apache_beam/io/hadoopfilesystem_test.py
b/sdks/python/apache_beam/io/hadoopfilesystem_test.py
index e83091f..5af2f7f 100644
--- a/sdks/python/apache_beam/io/hadoopfilesystem_test.py
+++ b/sdks/python/apache_beam/io/hadoopfilesystem_test.py
@@ -56,10 +56,6 @@ class FakeFile(io.BytesIO):
def __eq__(self, other):
return self.stat == other.stat and self.getvalue() == self.getvalue()
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def close(self):
self.saved_data = self.getvalue()
io.BytesIO.close(self)
diff --git a/sdks/python/apache_beam/io/restriction_trackers.py
b/sdks/python/apache_beam/io/restriction_trackers.py
index ff7345f..ad480f8 100644
--- a/sdks/python/apache_beam/io/restriction_trackers.py
+++ b/sdks/python/apache_beam/io/restriction_trackers.py
@@ -44,10 +44,6 @@ class OffsetRange(object):
return self.start == other.start and self.stop == other.stop
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return hash((type(self), self.start, self.stop))
diff --git a/sdks/python/apache_beam/metrics/cells.py
b/sdks/python/apache_beam/metrics/cells.py
index 9a1df29..404c305 100644
--- a/sdks/python/apache_beam/metrics/cells.py
+++ b/sdks/python/apache_beam/metrics/cells.py
@@ -288,11 +288,6 @@ class DistributionResult(object):
# type: () -> int
return hash(self.data)
- def __ne__(self, other):
- # type: (object) -> bool
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __repr__(self):
# type: () -> str
return 'DistributionResult(sum={}, count={}, min={}, max={})'.format(
@@ -347,11 +342,6 @@ class GaugeResult(object):
# type: () -> int
return hash(self.data)
- def __ne__(self, other):
- # type: (object) -> bool
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __repr__(self):
return '<GaugeResult(value={}, timestamp={})>'.format(
self.value, self.timestamp)
@@ -393,11 +383,6 @@ class GaugeData(object):
# type: () -> int
return hash((self.value, self.timestamp))
- def __ne__(self, other):
- # type: (object) -> bool
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __repr__(self):
# type: () -> str
return '<GaugeData(value={}, timestamp={})>'.format(
@@ -459,11 +444,6 @@ class DistributionData(object):
# type: () -> int
return hash((self.sum, self.count, self.min, self.max))
- def __ne__(self, other):
- # type: (object) -> bool
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __repr__(self):
# type: () -> str
return 'DistributionData(sum={}, count={}, min={}, max={})'.format(
diff --git a/sdks/python/apache_beam/metrics/execution.py
b/sdks/python/apache_beam/metrics/execution.py
index 72b9be2..a6b11b2 100644
--- a/sdks/python/apache_beam/metrics/execution.py
+++ b/sdks/python/apache_beam/metrics/execution.py
@@ -88,10 +88,6 @@ class MetricKey(object):
self.step == other.step and self.metric == other.metric and
self.labels == other.labels)
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return hash((self.step, self.metric, frozenset(self.labels)))
@@ -131,10 +127,6 @@ class MetricResult(object):
self.key == other.key and self.committed == other.committed and
self.attempted == other.attempted)
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return hash((self.key, self.committed, self.attempted))
@@ -195,9 +187,6 @@ class _TypedMetricName(object):
return self is other or (
self.cell_type == other.cell_type and self.fast_name ==
other.fast_name)
- def __ne__(self, other):
- return not self == other
-
def __hash__(self):
return self._hash
diff --git a/sdks/python/apache_beam/metrics/metricbase.py
b/sdks/python/apache_beam/metrics/metricbase.py
index b89b4bb..fbd6f79 100644
--- a/sdks/python/apache_beam/metrics/metricbase.py
+++ b/sdks/python/apache_beam/metrics/metricbase.py
@@ -82,10 +82,6 @@ class MetricName(object):
self.namespace == other.namespace and self.name == other.name and
self.urn == other.urn and self.labels == other.labels)
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __str__(self):
if self.urn:
return 'MetricName(namespace={}, name={}, urn={}, labels={})'.format(
diff --git a/sdks/python/apache_beam/options/value_provider.py
b/sdks/python/apache_beam/options/value_provider.py
index 0fa5f2b..a300df4 100644
--- a/sdks/python/apache_beam/options/value_provider.py
+++ b/sdks/python/apache_beam/options/value_provider.py
@@ -88,10 +88,6 @@ class StaticValueProvider(ValueProvider):
return True
return False
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return hash((type(self), self.value_type, self.value))
diff --git a/sdks/python/apache_beam/pvalue.py
b/sdks/python/apache_beam/pvalue.py
index 0744e98..eb5ae54 100644
--- a/sdks/python/apache_beam/pvalue.py
+++ b/sdks/python/apache_beam/pvalue.py
@@ -152,10 +152,6 @@ class PCollection(PValue, Generic[T]):
if isinstance(other, PCollection):
return self.tag == other.tag and self.producer == other.producer
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return hash((self.tag, self.producer))
@@ -679,9 +675,6 @@ class Row(object):
def __eq__(self, other):
return type(self) == type(other) and self.__dict__ == other.__dict__
- def __ne__(self, other):
- return not self == other
-
def __reduce__(self):
return _make_Row, tuple(sorted(self.__dict__.items()))
diff --git a/sdks/python/apache_beam/runners/common.py
b/sdks/python/apache_beam/runners/common.py
index 533d8d7..7703ae7 100644
--- a/sdks/python/apache_beam/runners/common.py
+++ b/sdks/python/apache_beam/runners/common.py
@@ -93,10 +93,6 @@ class NameContext(object):
def __eq__(self, other):
return self.step_name == other.step_name
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __repr__(self):
return 'NameContext(%s)' % self.__dict__
@@ -136,10 +132,6 @@ class DataflowNameContext(NameContext):
self.user_name == other.user_name and
self.system_name == other.system_name)
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return hash((self.step_name, self.user_name, self.system_name))
diff --git a/sdks/python/apache_beam/testing/test_stream.py
b/sdks/python/apache_beam/testing/test_stream.py
index 590792c..c2c084f 100644
--- a/sdks/python/apache_beam/testing/test_stream.py
+++ b/sdks/python/apache_beam/testing/test_stream.py
@@ -77,10 +77,6 @@ class Event(with_metaclass(ABCMeta, object)): # type:
ignore[misc]
def __lt__(self, other):
raise NotImplementedError
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
@abstractmethod
def to_runner_api(self, element_coder):
raise NotImplementedError
diff --git a/sdks/python/apache_beam/testing/util.py
b/sdks/python/apache_beam/testing/util.py
index 110ec41..49230e2 100644
--- a/sdks/python/apache_beam/testing/util.py
+++ b/sdks/python/apache_beam/testing/util.py
@@ -75,10 +75,6 @@ def contains_in_any_order(iterable):
def __eq__(self, other):
return self._counter == collections.Counter(other)
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return hash(self._counter)
diff --git a/sdks/python/apache_beam/transforms/core.py
b/sdks/python/apache_beam/transforms/core.py
index f75a828..6bf5fb7 100644
--- a/sdks/python/apache_beam/transforms/core.py
+++ b/sdks/python/apache_beam/transforms/core.py
@@ -448,10 +448,6 @@ class _DoFnParam(object):
return self.param_id == other.param_id
return False
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return hash(self.param_id)
@@ -2697,10 +2693,6 @@ class Windowing(object):
self.environment_id == self.environment_id)
return False
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return hash((
self.windowfn,
diff --git a/sdks/python/apache_beam/transforms/cy_combiners.py
b/sdks/python/apache_beam/transforms/cy_combiners.py
index b6f6fa9..7e4cb0e 100644
--- a/sdks/python/apache_beam/transforms/cy_combiners.py
+++ b/sdks/python/apache_beam/transforms/cy_combiners.py
@@ -62,10 +62,6 @@ class AccumulatorCombineFn(core.CombineFn):
isinstance(other, AccumulatorCombineFn) and
self._accumulator_type is other._accumulator_type)
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return hash(self._accumulator_type)
diff --git a/sdks/python/apache_beam/transforms/display.py
b/sdks/python/apache_beam/transforms/display.py
index 65fb567..518bde6 100644
--- a/sdks/python/apache_beam/transforms/display.py
+++ b/sdks/python/apache_beam/transforms/display.py
@@ -321,10 +321,6 @@ class DisplayDataItem(object):
return self._get_dict() == other._get_dict()
return False
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return hash(tuple(sorted(self._get_dict().items())))
diff --git a/sdks/python/apache_beam/transforms/environments.py
b/sdks/python/apache_beam/transforms/environments.py
index 6ea8f31..282ef9c 100644
--- a/sdks/python/apache_beam/transforms/environments.py
+++ b/sdks/python/apache_beam/transforms/environments.py
@@ -258,10 +258,6 @@ class DockerEnvironment(Environment):
return self.__class__ == other.__class__ \
and self.container_image == other.container_image
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return hash((self.__class__, self.container_image))
@@ -352,10 +348,6 @@ class ProcessEnvironment(Environment):
and self.command == other.command and self.os == other.os \
and self.arch == other.arch and self.env == other.env
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
# type: () -> int
return hash((
@@ -450,10 +442,6 @@ class ExternalEnvironment(Environment):
return self.__class__ == other.__class__ and self.url == other.url \
and self.params == other.params
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
# type: () -> int
return hash((
@@ -517,10 +505,6 @@ class EmbeddedPythonEnvironment(Environment):
def __eq__(self, other):
return self.__class__ == other.__class__
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
# type: () -> int
return hash(self.__class__)
@@ -563,10 +547,6 @@ class EmbeddedPythonGrpcEnvironment(Environment):
and self.state_cache_size == other.state_cache_size \
and self.data_buffer_time_limit_ms ==
other.data_buffer_time_limit_ms
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
# type: () -> int
return hash(
@@ -655,10 +635,6 @@ class SubprocessSDKEnvironment(Environment):
return self.__class__ == other.__class__ \
and self.command_string == other.command_string
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
# type: () -> int
return hash((self.__class__, self.command_string))
diff --git a/sdks/python/apache_beam/transforms/trigger.py
b/sdks/python/apache_beam/transforms/trigger.py
index cd3b10e..d9fc60d 100644
--- a/sdks/python/apache_beam/transforms/trigger.py
+++ b/sdks/python/apache_beam/transforms/trigger.py
@@ -267,10 +267,6 @@ class TriggerFn(with_metaclass(ABCMeta, object)): # type:
ignore[misc]
def to_runner_api(self, unused_context):
pass
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
class DefaultTrigger(TriggerFn):
"""Semantically Repeatedly(AfterWatermark()), but more optimized."""
@@ -1167,10 +1163,6 @@ class _UnwindowedValues(observable.ObservableMixin):
def __hash__(self):
return hash(tuple(self))
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
coder_impl.FastPrimitivesCoderImpl.register_iterable_like_type(
_UnwindowedValues)
diff --git a/sdks/python/apache_beam/transforms/window.py
b/sdks/python/apache_beam/transforms/window.py
index bdf0f26..3915192 100644
--- a/sdks/python/apache_beam/transforms/window.py
+++ b/sdks/python/apache_beam/transforms/window.py
@@ -304,9 +304,6 @@ class TimestampedValue(object):
def __hash__(self):
return hash((self.value, self.timestamp))
- def __ne__(self, other):
- return not self == other
-
def __lt__(self, other):
if type(self) != type(other):
return type(self).__name__ < type(other).__name__
@@ -338,9 +335,6 @@ class GlobalWindow(BoundedWindow):
# Global windows are always and only equal to each other.
return self is other or type(self) is type(other)
- def __ne__(self, other):
- return not self == other
-
@property
def start(self):
# type: () -> Timestamp
@@ -391,9 +385,6 @@ class GlobalWindows(NonMergingWindowFn):
# Global windowfn is always and only equal to each other.
return self is other or type(self) is type(other)
- def __ne__(self, other):
- return not self == other
-
def to_runner_api_parameter(self, context):
return common_urns.global_windows.urn, None
@@ -454,9 +445,6 @@ class FixedWindows(NonMergingWindowFn):
def __hash__(self):
return hash((self.size, self.offset))
- def __ne__(self, other):
- return not self == other
-
def to_runner_api_parameter(self, context):
return (
common_urns.fixed_windows.urn,
@@ -525,9 +513,6 @@ class SlidingWindows(NonMergingWindowFn):
self.size == other.size and self.offset == other.offset and
self.period == other.period)
- def __ne__(self, other):
- return not self == other
-
def __hash__(self):
return hash((self.offset, self.period))
@@ -604,9 +589,6 @@ class Sessions(WindowFn):
if type(self) == type(other) == Sessions:
return self.gap_size == other.gap_size
- def __ne__(self, other):
- return not self == other
-
def __hash__(self):
return hash(self.gap_size)
diff --git a/sdks/python/apache_beam/typehints/decorators.py
b/sdks/python/apache_beam/typehints/decorators.py
index c0ebe9d..3dc9878 100644
--- a/sdks/python/apache_beam/typehints/decorators.py
+++ b/sdks/python/apache_beam/typehints/decorators.py
@@ -539,9 +539,6 @@ class IOTypeHints(NamedTuple(
same(self.input_types, other.input_types) and
same(self.output_types, other.output_types))
- def __ne__(self, other):
- return not self == other
-
def __hash__(self):
return hash(str(self))
diff --git a/sdks/python/apache_beam/typehints/row_type.py
b/sdks/python/apache_beam/typehints/row_type.py
index 715297a..f301aed 100644
--- a/sdks/python/apache_beam/typehints/row_type.py
+++ b/sdks/python/apache_beam/typehints/row_type.py
@@ -40,10 +40,6 @@ class RowTypeConstraint(typehints.TypeConstraint):
def __eq__(self, other):
return type(self) == type(other) and self._fields == other._fields
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return hash(self._fields)
diff --git a/sdks/python/apache_beam/typehints/trivial_inference.py
b/sdks/python/apache_beam/typehints/trivial_inference.py
index 038ba8f..9d47262 100644
--- a/sdks/python/apache_beam/typehints/trivial_inference.py
+++ b/sdks/python/apache_beam/typehints/trivial_inference.py
@@ -118,10 +118,6 @@ class Const(object):
def __eq__(self, other):
return isinstance(other, Const) and self.value == other.value
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return hash(self.value)
@@ -151,10 +147,6 @@ class FrameState(object):
def __eq__(self, other):
return isinstance(other, FrameState) and self.__dict__ == other.__dict__
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return hash(tuple(sorted(self.__dict__.items())))
diff --git a/sdks/python/apache_beam/typehints/typehints.py
b/sdks/python/apache_beam/typehints/typehints.py
index 3920d81..e1ddc11 100644
--- a/sdks/python/apache_beam/typehints/typehints.py
+++ b/sdks/python/apache_beam/typehints/typehints.py
@@ -182,10 +182,6 @@ class TypeConstraint(object):
else:
visitor(t, visitor_arg)
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def match_type_variables(type_constraint, concrete_type):
if isinstance(type_constraint, TypeConstraint):
diff --git a/sdks/python/apache_beam/utils/timestamp.py
b/sdks/python/apache_beam/utils/timestamp.py
index 22c9f33..f06823a 100644
--- a/sdks/python/apache_beam/utils/timestamp.py
+++ b/sdks/python/apache_beam/utils/timestamp.py
@@ -29,7 +29,6 @@ from __future__ import division
import datetime
import time
from builtins import object
-from typing import Any
from typing import Union
from typing import overload
@@ -217,11 +216,6 @@ class Timestamp(object):
# Support equality with other types
return NotImplemented
- def __ne__(self, other):
- # type: (Any) -> bool
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __lt__(self, other):
# type: (TimestampDurationTypes) -> bool
# Allow comparisons between Duration and Timestamp values.
@@ -378,11 +372,6 @@ class Duration(object):
# Support equality with other types
return NotImplemented
- def __ne__(self, other):
- # type: (Any) -> bool
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __lt__(self, other):
# type: (TimestampDurationTypes) -> bool
# Allow comparisons between Duration and Timestamp values.
diff --git a/sdks/python/apache_beam/utils/windowed_value.py
b/sdks/python/apache_beam/utils/windowed_value.py
index df65ce9..39d17d0 100644
--- a/sdks/python/apache_beam/utils/windowed_value.py
+++ b/sdks/python/apache_beam/utils/windowed_value.py
@@ -154,10 +154,6 @@ class PaneInfo(object):
self.timing == other.timing and self.index == other.index and
self.nonspeculative_index == other.nonspeculative_index)
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return hash((
self.is_first,
@@ -255,10 +251,6 @@ class WindowedValue(object):
self.value == other.value and self.windows == other.windows and
self.pane_info == other.pane_info)
- def __ne__(self, other):
- # TODO(BEAM-5949): Needed for Python 2 compatibility.
- return not self == other
-
def __hash__(self):
return ((hash(self.value) & 0xFFFFFFFFFFFFFFF) + 3 *
(self.timestamp_micros & 0xFFFFFFFFFFFFFF) + 7 *
@@ -351,8 +343,5 @@ class _IntervalWindowBase(object):
self._start_micros == other._start_micros and
self._end_micros == other._end_micros)
- def __ne__(self, other):
- return not self == other
-
def __repr__(self):
return '[%s, %s)' % (float(self.start), float(self.end))