.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.preferences.EnginesSetting Class Reference
+ Inheritance diagram for searx.preferences.EnginesSetting:
+ Collaboration diagram for searx.preferences.EnginesSetting:

Public Member Functions

 __init__ (self, default_value, Iterable[Engine] engines)
 
 transform_form_items (self, items)
 
 transform_values (self, values)
 
- Public Member Functions inherited from searx.preferences.BooleanChoices
 parse_cookie (self, str data_disabled, str data_enabled)
 
 parse_form (self, List[str] items)
 
 enabled (self)
 
 disabled (self)
 
 save (self, flask.Response resp)
 
 get_disabled (self)
 
 get_enabled (self)
 

Additional Inherited Members

- Public Attributes inherited from searx.preferences.BooleanChoices
 name = name
 
 choices = choices
 
 locked = locked
 
 default_choices = dict(choices)
 
bool choices = False
 
 disabled
 
 enabled
 

Detailed Description

Engine settings

Definition at line 287 of file preferences.py.

Constructor & Destructor Documentation

◆ __init__()

searx.preferences.EnginesSetting.__init__ ( self,
default_value,
Iterable[Engine] engines )

Reimplemented from searx.preferences.BooleanChoices.

Definition at line 290 of file preferences.py.

290 def __init__(self, default_value, engines: Iterable[Engine]):
291 choices = {}
292 for engine in engines:
293 for category in engine.categories:
294 if not category in list(settings['categories_as_tabs'].keys()) + [DEFAULT_CATEGORY]:
295 continue
296 choices['{}__{}'.format(engine.name, category)] = not engine.disabled
297 super().__init__(default_value, choices)
298

References searx.preferences.EnginesSetting.__init__(), and searx.format.

Referenced by searx.preferences.EnginesSetting.__init__().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ transform_form_items()

searx.preferences.EnginesSetting.transform_form_items ( self,
items )

Reimplemented from searx.preferences.BooleanChoices.

Definition at line 299 of file preferences.py.

299 def transform_form_items(self, items):
300 return [item[len('engine_') :].replace('_', ' ').replace(' ', '__') for item in items]
301

Referenced by searx.preferences.BooleanChoices.parse_form().

+ Here is the caller graph for this function:

◆ transform_values()

searx.preferences.EnginesSetting.transform_values ( self,
values )

Reimplemented from searx.preferences.BooleanChoices.

Definition at line 302 of file preferences.py.

302 def transform_values(self, values):
303 if len(values) == 1 and next(iter(values)) == '':
304 return []
305 transformed_values = []
306 for value in values:
307 engine, category = value.split('__')
308 transformed_values.append((engine, category))
309 return transformed_values
310
311

The documentation for this class was generated from the following file: