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

change order of iterating

parent 666abfa2
No related branches found
No related tags found
No related merge requests found
...@@ -7,9 +7,9 @@ RUN git clone https://gitlab.com/caosdb/caosdb-pylib.git && \ ...@@ -7,9 +7,9 @@ RUN git clone https://gitlab.com/caosdb/caosdb-pylib.git && \
cd caosdb-pylib && pip3 install . cd caosdb-pylib && pip3 install .
RUN git clone https://gitlab.com/caosdb/caosdb-models.git && \ RUN git clone https://gitlab.com/caosdb/caosdb-models.git && \
cd caosdb-models && pip3 install . cd caosdb-models && pip3 install .
ADD https://gitlab.com/api/v4/projects/13601752/repository/branches/project_cfood \ ADD https://gitlab.com/api/v4/projects/13601752/repository/branches/master \
scifolder_version.json scifolder_version.json
RUN git clone -b project_cfood \ RUN git clone \
https://gitlab.com/henrik_indiscale/scifolder.git && \ https://gitlab.com/henrik_indiscale/scifolder.git && \
cd scifolder && pip3 install . cd scifolder && pip3 install .
COPY . /git COPY . /git
......
...@@ -79,22 +79,21 @@ class Crawler(object): ...@@ -79,22 +79,21 @@ class Crawler(object):
print("-"*60) print("-"*60)
print("Matching files against CFoods") print("Matching files against CFoods")
for crawled_file in files: for Cfood in self.food:
if self.verbosity >= VERBOSE: if self.verbosity >= VERBOSE:
print("Matching {}...".format(crawled_file.path)) print("Matching against {}...".format(Cfood.__name__))
# if crawled_file.size == 0:
# crawled_file.add_message(
# type="Warning", description="This file is empty. Shouldn't we delete it?")
# self.report.append(crawled_file)
# continue for crawled_file in files:
if self.verbosity >= DEBUG:
print("Matching {}...".format(crawled_file.path))
for Cfood in self.food:
if Cfood.match(crawled_file.path) is not None: if Cfood.match(crawled_file.path) is not None:
matches[crawled_file.path] += 1 matches[crawled_file.path] += 1
if self.verbosity >= VERBOSE: if self.verbosity >= VERBOSE:
print("{} matched.".format(Cfood.__name__)) print("{} matched\n{}.".format(
Cfood.__class__.__name__,
crawled_file.path))
try: try:
cfoods.append(Cfood(crawled_file, access=self.access, cfoods.append(Cfood(crawled_file, access=self.access,
verbosity=self.verbosity)) verbosity=self.verbosity))
...@@ -106,14 +105,19 @@ class Crawler(object): ...@@ -106,14 +105,19 @@ class Crawler(object):
print("-"*60) print("-"*60)
print("Trying to attach files to created CFoods") print("Trying to attach files to created CFoods")
for crawled_file in files: for cfood in cfoods:
if self.verbosity >= VERBOSE: if self.verbosity >= VERBOSE:
print("Matching against {}...".format(Cfood.__name__))
for crawled_file in files:
if self.verbosity >= DEBUG:
print("Matching {}...".format(crawled_file.path)) print("Matching {}...".format(crawled_file.path))
for cfood in cfoods:
if cfood.looking_for(crawled_file): if cfood.looking_for(crawled_file):
if self.verbosity >= VERBOSE: if self.verbosity >= VERBOSE:
print("{} matched.".format(cfood.__class__.__name__)) print("{} matched\n{}.".format(
Cfood.__class__.__name__,
crawled_file.path))
cfood.attach(crawled_file) cfood.attach(crawled_file)
matches[crawled_file.path] += 1 matches[crawled_file.path] += 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment