(self, ctx: Context)
| 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. |
no test coverage detected