Skip to content
Myr

Using correct typing for `param_hint` (#2990)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Rowlando13 · committed by GitHub · parents eaf33a9, b2f2643 · Browse files · 2 files+6 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+6 added−4 removed

  • other:+6 added−4 removed

2 files+6 added−4 removed

modified:src/click/exceptions.py+3 added-3 removed
113 unmodified lines
114 self,115 message: str,116 ctx: Context | None = None,117 param: Parameter | None = None,118 param_hint: str | None = None,118 param_hint: cabc.Sequence[str] | str | None = None,119 ) -> None:120 super().__init__(message, ctx)121 self.param = param122 self.param_hint = param_hint
27 unmodified lines
150 self,151 message: str | None = None,152 ctx: Context | None = None,153 param: Parameter | None = None,154 param_hint: str | None = None,154 param_hint: cabc.Sequence[str] | str | None = None,155 param_type: str | None = None,156 ) -> None:157 super().__init__(message or "", ctx, param, param_hint)158 self.param_type = param_type159160 def format_message(self) -> str:161 if self.param_hint is not None:162 param_hint: str | None = self.param_hint162 param_hint: cabc.Sequence[str] | str | None = self.param_hint163 elif self.param is not None:164 param_hint = self.param.get_error_hint(self.ctx) # type: ignore165 else:166 param_hint = None
142 unmodified lines
modified:CHANGES.rst+3 added-1 removed
6 unmodified lines
78- Fix reconciliation of `default`, `flag_value` and `type` parameters for9 flag options, as well as parsing and normalization of environment variables.10 :issue:`2952` :pr:`2956`11- Fix typing issue in ``BadParameter`` and ``MissingParameter`` exceptions for the12 parameter ``param_hint`` that did not allow for a sequence of string where the13 underlying functino ``_join_param_hints`` allows for it. :issue:`2777` :pr:`2990`14- Use the value of ``Enum`` choices to render their default value in help15 screen. Refs :issue:`2911` :pr:`3004`16- Fix completion for the Z shell (``zsh``) for completion items containing17 colons. :issue:`2703` :pr:`2846`181619Version 8.2.120-------------2122Released 2025-05-20
1241 unmodified lines