diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2014-03-26 12:40:17 +0000 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2014-03-26 12:40:17 +0000 |
commit | 9c88a8ff071c9a74e3b412bd4f4ef19cd9248611 (patch) | |
tree | ffc232d8714dd167b610782bdf93aec84437b65c | |
parent | 6b3b56ee17e14a0f0de8a16a6a52b3708d01146b (diff) | |
download | sos-9c88a8ff071c9a74e3b412bd4f4ef19cd9248611.tar.gz |
Dead code removal: utilities.checksum()
Has test case but no callers. Delete it.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/utilities.py | 15 | ||||
-rw-r--r-- | tests/utilities_tests.py | 12 |
2 files changed, 0 insertions, 27 deletions
diff --git a/sos/utilities.py b/sos/utilities.py index 8602a529..1a56f9f3 100644 --- a/sos/utilities.py +++ b/sos/utilities.py @@ -63,19 +63,6 @@ def fileobj(path_or_file, mode='r'): else: return closing(path_or_file) -def checksum(file_, chunk_size=128, algorithm=None): - """Returns the checksum of the supplied filename. The file is read in - chunk_size blocks""" - if not algorithm: - algorithm = get_hash_name() - digest = hashlib.new(algorithm) - with fileobj(file_, 'rb') as fd: - data = fd.read(chunk_size) - while data: - digest.update(six.b(data)) - data = fd.read(chunk_size) - return digest.hexdigest() - def get_hash_name(): """Returns the algorithm used when computing a hash""" import sos.policies @@ -101,8 +88,6 @@ def convert_bytes(bytes_, K=1 << 10, M=1 << 20, G=1 << 30, T=1 << 40): else: return '%d' % bytes_ - - def find(file_pattern, top_dir, max_depth=None, path_pattern=None): """generator function to find files recursively. Usage: diff --git a/tests/utilities_tests.py b/tests/utilities_tests.py index da0987ff..395fde13 100644 --- a/tests/utilities_tests.py +++ b/tests/utilities_tests.py @@ -43,18 +43,6 @@ class TailTest(unittest.TestCase): self.assertEquals(t, six.b(expected)) -class ChecksumTest(unittest.TestCase): - - def test_simple_hash(self): - self.assertEquals(checksum(StringIO('this is a test'), algorithm="sha256"), - '2e99758548972a8e8822ad47fa1017ff72f06f3ff6a016851f45c398732bc50c') - - def test_hash_loading(self): - # not the greatest test, since we are asking the policy to pick for us - name = get_hash_name() - self.assertTrue(name in ('md5', 'sha256')) - - class ExecutableTest(unittest.TestCase): def test_nonexe_file(self): |