MCPcopy
hub / github.com/pallets/click / get_params

Method get_params

src/click/core.py:1099–1122  ·  view source on GitHub ↗
(self, ctx: Context)

Source from the content-addressed store, hash-verified

1097 return formatter.getvalue().rstrip("\n")
1098
1099 def get_params(self, ctx: Context) -> list[Parameter]:
1100 params = self.params
1101 help_option = self.get_help_option(ctx)
1102
1103 if help_option is not None:
1104 params = [*params, help_option]
1105
1106 if __debug__:
1107 import warnings
1108
1109 opts = [opt for param in params for opt in param.opts]
1110 opts_counter = Counter(opts)
1111 duplicate_opts = (opt for opt, count in opts_counter.items() if count > 1)
1112
1113 for duplicate_opt in duplicate_opts:
1114 warnings.warn(
1115 (
1116 f"The parameter {duplicate_opt} is used more than once. "
1117 "Remove its duplicate as parameters should be unique."
1118 ),
1119 stacklevel=3,
1120 )
1121
1122 return params
1123
1124 def format_usage(self, ctx: Context, formatter: HelpFormatter) -> None:
1125 """Writes the usage line into the formatter.

Callers 8

to_info_dictMethod · 0.95
collect_usage_piecesMethod · 0.95
make_parserMethod · 0.95
format_optionsMethod · 0.95
parse_argsMethod · 0.95
shell_completeMethod · 0.95
command_pathMethod · 0.80
_resolve_incompleteFunction · 0.80

Calls 1

get_help_optionMethod · 0.95

Tested by

no test coverage detected