LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File add-hash-methods.diff of Package python-pyscard (Project home:frispete:chipcard)

--- smartcard/Card.py.orig	2011-05-27 22:25:02.000000000 +0200
+++ smartcard/Card.py	2011-07-14 11:15:46.945403717 +0200
@@ -55,6 +55,10 @@ class Card:
         False otherwise."""
         return not self.__eq__(other)
 
+    def __hash__(self):
+        """Returns a hash value for this object (str(self) is unique)."""
+        return hash(str(self))
+
     def createConnection(self):
         """Return a CardConnection to the Card object."""
         readerobj = None
--- smartcard/reader/Reader.py.orig	2011-05-27 22:25:01.000000000 +0200
+++ smartcard/reader/Reader.py	2011-07-14 11:15:46.933403549 +0200
@@ -55,6 +55,10 @@ class Reader:
         else:
             return 1
 
+    def __hash__(self):
+        """Returns a hash value for this object (self.name is unique)."""
+        return hash(self.name)
+
     def __repr__(self):
         """Returns card reader name string for `object` calls."""
         return "'%s'" % self.name