MCPcopy
hub / github.com/locustio/locust / add_argument

Method add_argument

locust/argument_parser.py:66–89  ·  view source on GitHub ↗

This method supports the same args as ArgumentParser.add_argument(..) as well as the additional args below. Arguments: include_in_web_ui: If True (default), the argument will show in the UI. is_secret: If True (default is False) and include_in_web_ui

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

64 self.exit(2, f"{self.prog}: error: {message}\n")
65
66 def add_argument(self, *args, **kwargs) -> configargparse.Action:
67 """
68 This method supports the same args as ArgumentParser.add_argument(..)
69 as well as the additional args below.
70
71 Arguments:
72 include_in_web_ui: If True (default), the argument will show in the UI.
73 is_secret: If True (default is False) and include_in_web_ui is True, the argument will show in the UI with a password masked text input.
74 is_required: If True (default is False) and include_in_web_ui is True, the argument will show in the UI as a required form field.
75 is_multiple: If True (default is False) and include_in_web_ui is True, the argument will show in the UI as a multiple select form field.
76
77 Returns:
78 argparse.Action: the new argparse action
79 """
80 include_in_web_ui = kwargs.pop("include_in_web_ui", True)
81 is_secret = kwargs.pop("is_secret", False)
82 is_required = kwargs.pop("is_required", False)
83 is_multiple = kwargs.pop("is_multiple", False)
84 action = super().add_argument(*args, **kwargs)
85 action.include_in_web_ui = include_in_web_ui
86 action.is_secret = is_secret
87 action.is_required = is_required
88 action.is_multiple = is_multiple
89 return action
90
91 @property
92 def args_included_in_web_ui(self) -> dict[str, configargparse.Action]:

Callers 8

parse_locustfile_optionFunction · 0.80
setup_parser_argumentsFunction · 0.80
_Method · 0.80
_Method · 0.80
_Method · 0.80
_Function · 0.80
dispatch.pyFile · 0.80

Calls

no outgoing calls

Tested by 3

_Method · 0.64
_Method · 0.64
_Method · 0.64