Skip to content
Snippets Groups Projects
Commit 1a81f354 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

ENH: show which cfoods have matched

parent c3dea802
No related branches found
No related tags found
No related merge requests found
...@@ -78,7 +78,7 @@ class Crawler(object): ...@@ -78,7 +78,7 @@ class Crawler(object):
errors_occured = False errors_occured = False
tbs = [] tbs = []
cfoods = [] cfoods = []
matches = {f: 0 for f in files} matches = {f: [] for f in files}
if self.verbosity >= INFO: if self.verbosity >= INFO:
print("-"*60) print("-"*60)
...@@ -93,7 +93,7 @@ class Crawler(object): ...@@ -93,7 +93,7 @@ class Crawler(object):
print("Matching {}...".format(crawled_file)) print("Matching {}...".format(crawled_file))
if Cfood.match(crawled_file) is not None: if Cfood.match(crawled_file) is not None:
matches[crawled_file] += 1 matches[crawled_file].append(Cfood.__name__)
if self.verbosity >= VERBOSE: if self.verbosity >= VERBOSE:
print("{} matched\n{}.".format( print("{} matched\n{}.".format(
...@@ -139,17 +139,18 @@ class Crawler(object): ...@@ -139,17 +139,18 @@ class Crawler(object):
Cfood.__class__.__name__, Cfood.__class__.__name__,
crawled_file)) crawled_file))
cfood.attach(crawled_file) cfood.attach(crawled_file)
matches[crawled_file] += 1 matches[crawled_file].append(Cfood.__name__)
if self.verbosity >= INFO: if self.verbosity >= INFO:
for crawled_file in files: for crawled_file in files:
if matches[crawled_file] == 0: if len(matches[crawled_file]) == 0:
print("ATTENTION: No matching cfood!") print("ATTENTION: No matching cfood!")
print("Tried to match {}".format(crawled_file)) 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("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 return cfoods, matches, tbs, errors_occured
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment