Browse Source

add hash function for ZipInfo objects... This lets us

ensure that two seperate ZipInfo objects that refer to the
same file compare equal..

[git-p4: depot-paths = "//depot/": change = 1573]
main
John-Mark Gurney 14 years ago
parent
commit
bb8d6fd10a
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      ZipStorage.py

+ 8
- 0
ZipStorage.py View File

@@ -70,12 +70,20 @@ def zipinfocmp(za, zb):

return 0

def zipinfohash(za):
r = 0
for i in [ 'filename', 'date_time', 'file_size', 'CRC' ]:
r ^= getattr(za, i).__hash__

return r

class ZIWrap(object):
__slots__ = [ '_zi' ]

def __init__(self, zi):
self._zi = zi

__hash__ = zipinfohash
__cmp__ = zipinfocmp

def __getattr__(self, n):


Loading…
Cancel
Save