How to use _format_help method in tox

Best Python code snippet using tox_python

parser.py

Source:parser.py Github

copy

Full Screen

...33 )34 parser.add_argument(35 '-t', '--target',36 dest='target', required=True,37 help=_format_help('Target domain/rootdomain/ip')38 )39 available_plugins = PluginController.get_available_plugins().keys()40 parser.add_argument(41 '-p', '--plugins', metavar='plugin',42 dest='plugins_specific', nargs='+', default=None,43 help=_format_help([44 'Specify the plugins',45 'avaliable: ' + '\n'.join([' '.join(available_plugins[i:i+3]) for i in range(0, len(available_plugins), 4)])46 ])47 )48 parser.add_argument(49 '-m', '--max_level', 50 dest='max_level', default=4,51 type=int, help=_format_help('Max level to get domain/ip/rootdomain')52 )53 parser.add_argument(54 '--pool_size', 55 dest='pool_size', type=int, default=500,56 help=_format_help('Max number of Thread pool size')57 )58 parser.add_argument(59 '-o', '--output_file',60 dest='output_file', default=None,61 help=_format_help('File to ouput result')62 )63 parser.add_argument(64 '--format',65 dest='output_format', default='csv',66 help=_format_help([67 'The format to output result,',68 'default list:',69 '/'.join(Output.get_output_formats())70 ])71 )72 # Log73 parser.add_argument(74 '--log_file',75 dest='log_file', default=None,76 help=_format_help('Log file')77 )78 loglevel_choices = {79 1: 'DEBUG',80 2: 'INFO',81 3: 'WARNING',82 4: 'ERROR',83 }84 parser.add_argument(85 '--log_level',86 dest='log_level',87 type=int, default=1, choices=loglevel_choices,88 help=_format_help('Log level of output to file', loglevel_choices)89 )90 # Proxy91 parser.add_argument(92 '--proxy_file',93 dest='proxy_file', default=None,94 help=_format_help([95 'Proxy file, one line one proxy, each line format:',96 'schem,proxy url,',97 'eg:http,http://1.1.1.1:123',98 ])99 )100 parser.add_argument(101 '--verify_proxy',102 dest='verify_proxy', default=False, action='store_true',103 help=_format_help('If verify the proxy list')104 )105 parser.add_argument(106 '--timeout',107 dest='timeout', type=int, default=10,108 help=_format_help('Request timeout')109 )110 parser.add_argument(111 '--alive_check', 112 dest='alive_check', default=False, action='store_true',113 help=_format_help('Check alive and accessible status of domain')114 )115 args = parser.parse_args()116 return args.__dict__117def _format_help(help_info, choices=None):118 if isinstance(help_info, list):119 help_str_list = help_info[:]120 else:121 help_str_list = [help_info]122 if choices:123 help_str_list.extend([124 '%s%s - %s' % (INDENT, k, v) for k, v in choices.items()125 ])126 help_str_list.append(INDENT + '(DEFAULT: %(default)s)')...

Full Screen

Full Screen

parse.py

Source:parse.py Github

copy

Full Screen

...27 parser.add_argument('-V', '--version', action='version',28 version=VERSION_INFO)29 parser.add_argument(30 '-t', '--target', dest='target', required=True,31 help=_format_help('Target domain/rootdomain/ip')32 )33 available_plugins = PluginController.get_available_plugins().keys()34 parser.add_argument(35 '-p', '--plugins', metavar='plugin',36 dest='plugins_specific', nargs='+',37 default=None,38 help=_format_help([39 'Specify the plugins',40 'avaliable: '+' ,'.join(available_plugins),41 ])42 )43 parser.add_argument(44 '-m', '--max_level', dest='max_level', default=4,45 type=int, help=_format_help('Max level to get domain/ip/rootdomain')46 )47 parser.add_argument(48 '-o', '--output_file', dest='output_file',49 help=_format_help('File to ouput result')50 )51 parser.add_argument(52 '--format', dest='output_format', default='csv',53 help=_format_help([54 'The format to output result,',55 'default list:',56 Output.get_output_formats()57 ])58 )59 parser.add_argument(60 '--log_file', dest='log_file',61 help=_format_help('Log file')62 )63 loglevel_choices = {64 1: 'DEBUG',65 2: 'INFO',66 3: 'WARNING',67 4: 'ERROR',68 }69 parser.add_argument(70 '--log_level', dest='log_level',71 type=int, default=1, choices=loglevel_choices,72 help=_format_help('Log level of output to file', loglevel_choices)73 )74 parser.add_argument(75 '--proxy_file', dest='proxy_file',76 help=_format_help([77 'Proxy file, one line one proxy, each line format:',78 'schem,proxy url,',79 'eg:http,http://1.1.1.1:123',80 ])81 )82 parser.add_argument(83 '--verify_proxy', dest='verify_proxy', action='store_true',84 default=False,85 help=_format_help('If verify the proxy list')86 )87 parser.add_argument(88 '--timeout', dest='timeout',89 type=int, default=10,90 help=_format_help('Request timeout')91 )92 args = parser.parse_args(args)93 return args949596def _format_help(help_info, choices=None):97 if isinstance(help_info, list):98 help_str_list = help_info[:]99 else:100 help_str_list = [help_info]101102 if choices:103 help_str_list.extend([104 '%s%s - %s' % (INDENT, k, v) for k, v in choices.items()105 ])106107 help_str_list.append(INDENT + '(DEFAULT: %(default)s)')108 ...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tox automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful