Ver código fonte

change unresponsive_engines to a set to eliminate duplication of errors

Noémi Ványi 7 anos atrás
pai
commit
2242000bd4
2 arquivos alterados com 4 adições e 4 exclusões
  1. 3
    3
      searx/results.py
  2. 1
    1
      tests/unit/test_webapp.py

+ 3
- 3
searx/results.py Ver arquivo

@@ -135,7 +135,7 @@ class ResultContainer(object):
135 135
         self._number_of_results = []
136 136
         self._ordered = False
137 137
         self.paging = False
138
-        self.unresponsive_engines = []
138
+        self.unresponsive_engines = set()
139 139
 
140 140
     def extend(self, engine_name, results):
141 141
         for result in list(results):
@@ -306,5 +306,5 @@ class ResultContainer(object):
306 306
             return 0
307 307
         return resultnum_sum / len(self._number_of_results)
308 308
 
309
-    def add_unresponsive_engine(self, engine_name):
310
-        self.unresponsive_engines.append(engine_name)
309
+    def add_unresponsive_engine(self, engine_error):
310
+        self.unresponsive_engines.add(engine_error)

+ 1
- 1
tests/unit/test_webapp.py Ver arquivo

@@ -39,7 +39,7 @@ class ViewsTestCase(SearxTestCase):
39 39
                                                 corrections=set(),
40 40
                                                 suggestions=set(),
41 41
                                                 infoboxes=[],
42
-                                                unresponsive_engines=[],
42
+                                                unresponsive_engines=set(),
43 43
                                                 results=self.test_results,
44 44
                                                 results_number=lambda: 3,
45 45
                                                 results_length=lambda: len(self.test_results))