.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.search.checker.__main__ Namespace Reference

Functions

 iter_processor (engine_name_list)
 
 run (engine_name_list, verbose)
 
 main ()
 

Variables

 root = logging.getLogger()
 
 handler = logging.StreamHandler(sys.stdout)
 
str RESET_SEQ = "\033[0m"
 
str COLOR_SEQ = "\033[1;%dm"
 
str BOLD_SEQ = "\033[1m"
 
 BLACK
 
 RED
 
 GREEN
 
 YELLOW
 
 BLUE
 
 MAGENTA
 
 CYAN
 
 WHITE
 
 stdout
 
 stderr
 

Function Documentation

◆ iter_processor()

searx.search.checker.__main__.iter_processor ( engine_name_list)

Definition at line 49 of file __main__.py.

49def iter_processor(engine_name_list):
50 if len(engine_name_list) > 0:
51 for name in engine_name_list:
52 name = engine_shortcuts.get(name, name)
53 processor = PROCESSORS.get(name)
54 if processor is not None:
55 yield name, processor
56 else:
57 stdout.write(f'{BOLD_SEQ}Engine {name:30}{RESET_SEQ}{RED}Engine does not exist{RESET_SEQ}\n')
58 else:
59 for name, processor in searx.search.PROCESSORS.items():
60 yield name, processor
61
62
63# actual check & display

Referenced by searx.search.checker.__main__.run().

+ Here is the caller graph for this function:

◆ main()

searx.search.checker.__main__.main ( )

Definition at line 96 of file __main__.py.

96def main():
97 parser = argparse.ArgumentParser(description='Check searx engines.')
98 parser.add_argument(
99 'engine_name_list',
100 metavar='engine name',
101 type=str,
102 nargs='*',
103 help='engines name or shortcut list. Empty for all engines.',
104 )
105 parser.add_argument(
106 '--verbose',
107 '-v',
108 action='store_true',
109 dest='verbose',
110 help='Display details about the test results',
111 default=False,
112 )
113 args = parser.parse_args()
114 run(args.engine_name_list, args.verbose)
115
116

References searx.search.checker.__main__.main(), and searx.search.checker.__main__.run().

Referenced by searx.search.checker.__main__.main().

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

◆ run()

searx.search.checker.__main__.run ( engine_name_list,
verbose )

Definition at line 64 of file __main__.py.

64def run(engine_name_list, verbose):
66 name_checker_list = []
67 for name, processor in iter_processor(engine_name_list):
68 stdout.write(f'{BOLD_SEQ}Engine {name:30}{RESET_SEQ}Checking\n')
69 if not sys.stdout.isatty():
70 stderr.write(f'{BOLD_SEQ}Engine {name:30}{RESET_SEQ}Checking\n')
71 checker = searx.search.checker.Checker(processor)
72 checker.run()
73 name_checker_list.append((name, checker))
74
75 stdout.write(f'\n== {BOLD_SEQ}Results{RESET_SEQ} ' + '=' * 70 + '\n')
76 for name, checker in name_checker_list:
77 if checker.test_results.successful:
78 stdout.write(f'{BOLD_SEQ}Engine {name:30}{RESET_SEQ}{GREEN}OK{RESET_SEQ}\n')
79 if verbose:
80 stdout.write(f' {"found languages":15}: {" ".join(sorted(list(checker.test_results.languages)))}\n')
81 else:
82 stdout.write(f'{BOLD_SEQ}Engine {name:30}{RESET_SEQ}{RESET_SEQ}{RED}Error{RESET_SEQ}')
83 if not verbose:
84 errors = [test_name + ': ' + error for test_name, error in checker.test_results]
85 stdout.write(f'{RED}Error {str(errors)}{RESET_SEQ}\n')
86 else:
87 stdout.write('\n')
88 stdout.write(f' {"found languages":15}: {" ".join(sorted(list(checker.test_results.languages)))}\n')
89 for test_name, logs in checker.test_results.logs.items():
90 for log in logs:
91 log = map(lambda l: l if isinstance(l, str) else repr(l), log)
92 stdout.write(f' {test_name:15}: {RED}{" ".join(log)}{RESET_SEQ}\n')
93
94
95# call by setup.py
initialize(settings_engines=None, enable_checker=False, check_network=False, enable_metrics=True)
Definition __init__.py:30

References searx.search.initialize(), and searx.search.checker.__main__.iter_processor().

Referenced by searx.search.checker.__main__.main().

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

Variable Documentation

◆ BLACK

searx.search.checker.__main__.BLACK

Definition at line 28 of file __main__.py.

◆ BLUE

searx.search.checker.__main__.BLUE

Definition at line 28 of file __main__.py.

◆ BOLD_SEQ

str searx.search.checker.__main__.BOLD_SEQ = "\033[1m"

Definition at line 27 of file __main__.py.

◆ COLOR_SEQ

str searx.search.checker.__main__.COLOR_SEQ = "\033[1;%dm"

Definition at line 26 of file __main__.py.

◆ CYAN

searx.search.checker.__main__.CYAN

Definition at line 28 of file __main__.py.

◆ GREEN

searx.search.checker.__main__.GREEN

Definition at line 28 of file __main__.py.

◆ handler

searx.search.checker.__main__.handler = logging.StreamHandler(sys.stdout)

Definition at line 18 of file __main__.py.

◆ MAGENTA

searx.search.checker.__main__.MAGENTA

Definition at line 28 of file __main__.py.

◆ RED

searx.search.checker.__main__.RED

Definition at line 28 of file __main__.py.

◆ RESET_SEQ

str searx.search.checker.__main__.RESET_SEQ = "\033[0m"

Definition at line 25 of file __main__.py.

◆ root

searx.search.checker.__main__.root = logging.getLogger()

Definition at line 17 of file __main__.py.

◆ stderr

searx.search.checker.__main__.stderr
Initial value:
1= io.TextIOWrapper(
2 # pylint: disable=consider-using-with
3 open(sys.stderr.fileno(), 'wb', 0),
4 write_through=True,
5)

Definition at line 41 of file __main__.py.

◆ stdout

searx.search.checker.__main__.stdout
Initial value:
1= io.TextIOWrapper(
2 # pylint: disable=consider-using-with
3 open(sys.stdout.fileno(), 'wb', 0),
4 write_through=True,
5)

Definition at line 36 of file __main__.py.

◆ WHITE

searx.search.checker.__main__.WHITE

Definition at line 28 of file __main__.py.

◆ YELLOW

searx.search.checker.__main__.YELLOW

Definition at line 28 of file __main__.py.