From a56a3eb86d7c2b665be421ba5df4828b8b3e9ec3 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Fri, 11 May 2018 14:01:14 +0200 Subject: [PATCH] Use os.scandir instead of os.listdir It's simpler and better suited for use cases introduced in later commits. --- src/documents/consumer.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/documents/consumer.py b/src/documents/consumer.py index 3d7cc7bd1..6f9273b03 100644 --- a/src/documents/consumer.py +++ b/src/documents/consumer.py @@ -71,8 +71,7 @@ class Consumer: }) def run(self): - docs = [os.path.join(self.consume, entry) - for entry in os.listdir(self.consume)] + docs = [entry.path for entry in os.scandir(self.consume)] docs_old_to_new = sorted(docs, key=lambda doc: os.path.getmtime(doc)) for doc in docs_old_to_new: