From 3aded082c2326be4a517d490a34d00136f4646f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Andr=C3=A9e?= Date: Thu, 4 Apr 2013 01:44:17 +0200 Subject: [PATCH] files are horrible unsorted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/spellocorrecter.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/spellocorrecter.py b/src/spellocorrecter.py index 3a9589b2..ac3f39e7 100755 --- a/src/spellocorrecter.py +++ b/src/spellocorrecter.py @@ -84,7 +84,9 @@ class SpelloCorrecter(): # Naïvely and quickly ported and adapted from optimise if ending is not None: for directory in directories: - for filename in os.listdir(directory): + files = os.listdir(directory) + files.sort() + for filename in files: if (not endswith(filename, ending)) or (len(filename) - len(ending) > 127): continue proper = filename[:-len(ending)] @@ -105,7 +107,9 @@ class SpelloCorrecter(): # Naïvely and quickly ported and adapted from optimise previous = proper self.reusable[self.dictionaryEnd] = prevCommon else: - for proper in directories: + files = directories + files.sort() + for proper in files: if len(proper) > 127: continue