From 82755021e6a98baa0e58e79e48cbab28db6f3a02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <henrik@trineo.org> Date: Fri, 27 Sep 2019 11:33:21 +0200 Subject: [PATCH] ENH: allow to disable interactive mode --- integrationtests/full_test/crawl.py | 2 +- src/caosadvancedtools/crawler.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/integrationtests/full_test/crawl.py b/integrationtests/full_test/crawl.py index 4c4bf4cc..5719e072 100755 --- a/integrationtests/full_test/crawl.py +++ b/integrationtests/full_test/crawl.py @@ -61,4 +61,4 @@ if __name__ == "__main__": AnalysisCFood, ExperimentCFood, PublicationCFood, SimulationCFood, ]) - c.crawl(files, security_level=UPDATE) + c.crawl(files, interactive=False, security_level=UPDATE) diff --git a/src/caosadvancedtools/crawler.py b/src/caosadvancedtools/crawler.py index d5da0a82..8a7698b8 100644 --- a/src/caosadvancedtools/crawler.py +++ b/src/caosadvancedtools/crawler.py @@ -74,7 +74,7 @@ class Crawler(object): if self.use_cache: self.cache = Cache() - def crawl(self, files, security_level=RETRIEVE): + def crawl(self, files, interactive=True, security_level=RETRIEVE): errors_occured = False tbs = [] guard.set_level(level=security_level) @@ -147,7 +147,7 @@ class Crawler(object): print("Attention: More than one matching cfood!") print("Tried to match {}".format(crawled_file.path)) - if "y" != input("Do you want to continue? (y)"): + if interactive and "y" != input("Do you want to continue? (y)"): return if self.verbosity >= INFO: -- GitLab