Skip to content
This repository has been archived by the owner on Jul 24, 2018. It is now read-only.

Commit

Permalink
Merge branch 'develop' of github.com:ralphbean/summershum into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Feb 7, 2014
2 parents d0ebf50 + 34a1ebb commit a3b6dc9
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions summershum/utils.py
Expand Up @@ -88,21 +88,18 @@ def walk_directory(directory):
""" Return a tuple (filename, sha1) for every files present in the
specified folder and do so recursively.
"""

output = []
for root, dirnames, filenames in os.walk(directory):

for filename in filenames:
file_path = os.path.join(root, filename)
with open(file_path) as stream:
sha = hashlib.sha1(stream.read()).hexdigest()
output.append((file_path, sha))
yield (file_path, sha)

for dirname in dirnames:
full_path = os.path.join(root, dirname)
output.extend(walk_directory(full_path))

return output
for item in walk_directory(full_path):
yield item


def __get_messages(cnt=10):
Expand Down

0 comments on commit a3b6dc9

Please sign in to comment.