From 1a81f354e86ad4cea79871cdd8f44da314c8d0ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <henrik@trineo.org> Date: Tue, 17 Dec 2019 20:58:49 +0100 Subject: [PATCH] ENH: show which cfoods have matched --- src/caosadvancedtools/crawler.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/caosadvancedtools/crawler.py b/src/caosadvancedtools/crawler.py index b0b7785b..6f26aacd 100644 --- a/src/caosadvancedtools/crawler.py +++ b/src/caosadvancedtools/crawler.py @@ -78,7 +78,7 @@ class Crawler(object): errors_occured = False tbs = [] cfoods = [] - matches = {f: 0 for f in files} + matches = {f: [] for f in files} if self.verbosity >= INFO: print("-"*60) @@ -93,7 +93,7 @@ class Crawler(object): print("Matching {}...".format(crawled_file)) if Cfood.match(crawled_file) is not None: - matches[crawled_file] += 1 + matches[crawled_file].append(Cfood.__name__) if self.verbosity >= VERBOSE: print("{} matched\n{}.".format( @@ -139,17 +139,18 @@ class Crawler(object): Cfood.__class__.__name__, crawled_file)) cfood.attach(crawled_file) - matches[crawled_file] += 1 + matches[crawled_file].append(Cfood.__name__) if self.verbosity >= INFO: for crawled_file in files: - if matches[crawled_file] == 0: + if len(matches[crawled_file]) == 0: print("ATTENTION: No matching cfood!") print("Tried to match {}".format(crawled_file)) - if matches[crawled_file] > 1: + if len(matches[crawled_file]) > 1: print("Attention: More than one matching cfood!") - print("Tried to match {}".format(crawled_file)) + print("Tried to match {}:".format(crawled_file)) + print("\t\t" + ", ".join(matches[crawled_file])) return cfoods, matches, tbs, errors_occured -- GitLab