Skip to content

Commit 9a21e01

Browse files
committed
pyDKB/*/consumer: make FileConsumer._filenames_form_dir() generator.
Not a big deal, but most of FileConsumer methods, related to input files, are generators -- so why not. Now instead of checking all files in the directory and creating a list of those with proper extension, it yields first file name that fits requirements, and checks next file only when asked about it.
1 parent 727f2a0 commit 9a21e01

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Utils/Dataflow/pyDKB/dataflow/communication/consumer/FileConsumer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ def _filenames_from_dir(self, dirname):
111111
if os.path.isfile(os.path.join(dirname, f)) \
112112
and f.lower().endswith(ext):
113113
files.append(f)
114+
yield f
114115
except OSError, err:
115116
raise Consumer.ConsumerException(err)
116-
return files
117117

118118
def _adjusted_filenames(self):
119119
""" Return iterable object, yielding filename and path to file. """

0 commit comments

Comments
 (0)