diff options
author | André Erdmann <dywi@mailerd.de> | 2013-06-04 12:09:32 +0200 |
---|---|---|
committer | André Erdmann <dywi@mailerd.de> | 2013-06-04 12:09:32 +0200 |
commit | 1f81d380522b5e81614fb20bc8af1667b5865006 (patch) | |
tree | 5b7fba7ed3329ddc70e3734c8f5583bcb4fe2d3a /roverlay/digest.py | |
parent | fix AttributeError in depres/simpledeprule (diff) | |
download | R_overlay-1f81d380522b5e81614fb20bc8af1667b5865006.tar.gz R_overlay-1f81d380522b5e81614fb20bc8af1667b5865006.tar.bz2 R_overlay-1f81d380522b5e81614fb20bc8af1667b5865006.zip |
Consistently use spaces instead of tabs for indention.
Diffstat (limited to 'roverlay/digest.py')
-rw-r--r-- | roverlay/digest.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/roverlay/digest.py b/roverlay/digest.py index 7d32217..218f98c 100644 --- a/roverlay/digest.py +++ b/roverlay/digest.py @@ -7,41 +7,41 @@ """provides digest related utility functions (e.g. md5sum_file())""" __all__ = [ 'digest_compare', 'digest_supported', - 'dodigest_file', 'md5sum_file' + 'dodigest_file', 'md5sum_file' ] import hashlib def md5sum_file ( fh, binary_digest=False ): - """Returns the md5 sum for an already opened file.""" - md5 = hashlib.md5() - blocksize = 16384 + """Returns the md5 sum for an already opened file.""" + md5 = hashlib.md5() + blocksize = 16384 - block = fh.read ( blocksize ) - while block: - md5.update ( block ) - block = fh.read ( blocksize ) + block = fh.read ( blocksize ) + while block: + md5.update ( block ) + block = fh.read ( blocksize ) - return md5.digest() if binary_digest else md5.hexdigest() + return md5.digest() if binary_digest else md5.hexdigest() # --- end of md5sum_file (...) --- _DIGEST_MAP = dict ( - md5 = md5sum_file, + md5 = md5sum_file, ) def digest_supported ( digest_type ): - """Returns True if the given digest type is supported, else False.""" - return digest_type in _DIGEST_MAP + """Returns True if the given digest type is supported, else False.""" + return digest_type in _DIGEST_MAP # --- digest_supported (...) --- def dodigest_file ( _file, digest_type, binary_digest=False ): - ret = None - with open ( _file, mode='rb' ) as fh: - ret = _DIGEST_MAP [digest_type] ( fh, binary_digest=binary_digest ) - return ret + ret = None + with open ( _file, mode='rb' ) as fh: + ret = _DIGEST_MAP [digest_type] ( fh, binary_digest=binary_digest ) + return ret # --- end of dodigest_file (...) --- def digest_compare ( _file, digest, digest_type, binary_digest=False ): - return digest == dodigest_file ( _file, digest_type, binary_digest ) + return digest == dodigest_file ( _file, digest_type, binary_digest ) # --- end of digest_compare (...) --- |