From a7243b5ac5b6fcaff0ba066bad35fa746cbe4317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 27 Nov 2015 01:42:40 +0100 Subject: [PATCH] bugfix: add patterns to cache before returning them --- gallery_dl/extractor/__init__.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/gallery_dl/extractor/__init__.py b/gallery_dl/extractor/__init__.py index aad5006d..f78ef8e7 100644 --- a/gallery_dl/extractor/__init__.py +++ b/gallery_dl/extractor/__init__.py @@ -61,17 +61,20 @@ _cache = [] _module_iter = iter(modules) def _list_patterns(): - """Yield all available (pattern, info, class) tuples""" + """Yield all available (pattern, class) tuples""" for entry in _cache: yield entry for module_name in _module_iter: module = importlib.import_module("."+module_name, __package__) - for klass in _get_classes(module): - for pattern in klass.pattern: - etuple = (pattern, klass) - _cache.append(etuple) - yield etuple + tuples = [ + (pattern, klass) + for klass in _get_classes(module) + for pattern in klass.pattern + ] + _cache.extend(tuples) + for etuple in tuples: + yield etuple def _get_classes(module): """Return a list of all extractor classes in a module"""