Browse Source

change unresponsive_engines to a set to eliminate duplication of errors

Noémi Ványi 7 years ago
parent
commit
2242000bd4
2 changed files with 4 additions and 4 deletions
  1. 3
    3
      searx/results.py
  2. 1
    1
      tests/unit/test_webapp.py

+ 3
- 3
searx/results.py View File

135
         self._number_of_results = []
135
         self._number_of_results = []
136
         self._ordered = False
136
         self._ordered = False
137
         self.paging = False
137
         self.paging = False
138
-        self.unresponsive_engines = []
138
+        self.unresponsive_engines = set()
139
 
139
 
140
     def extend(self, engine_name, results):
140
     def extend(self, engine_name, results):
141
         for result in list(results):
141
         for result in list(results):
306
             return 0
306
             return 0
307
         return resultnum_sum / len(self._number_of_results)
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 View File

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