You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by dh...@apache.org on 2016/08/11 23:08:24 UTC
[2/2] incubator-beam git commit: Fix hashing and comparison for
compression types
Fix hashing and comparison for compression types
Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/588d2f32
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/588d2f32
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/588d2f32
Branch: refs/heads/python-sdk
Commit: 588d2f328b80f5e30b4c8905d8b31078396f53cf
Parents: 450b647
Author: Ahmet Altay <al...@google.com>
Authored: Thu Aug 11 14:19:39 2016 -0700
Committer: Dan Halperin <dh...@google.com>
Committed: Thu Aug 11 16:08:15 2016 -0700
----------------------------------------------------------------------
sdks/python/apache_beam/io/fileio.py | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/588d2f32/sdks/python/apache_beam/io/fileio.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/fileio.py b/sdks/python/apache_beam/io/fileio.py
index 9b98a43..a6ce26a 100644
--- a/sdks/python/apache_beam/io/fileio.py
+++ b/sdks/python/apache_beam/io/fileio.py
@@ -283,7 +283,17 @@ class _CompressionType(object):
self.identifier = identifier
def __eq__(self, other):
- return self.identifier == other.identifier
+ return (isinstance(other, _CompressionType) and
+ self.identifier == other.identifier)
+
+ def __hash__(self):
+ return hash(self.identifier)
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
+ def __repr__(self):
+ return '_CompressionType(%s)' % self.identifier
class CompressionTypes(object):