Marco Ricci commited on 2025-11-29 22:35:16
Zeige 2 geänderte Dateien mit 23 Einfügungen und 3 Löschungen.
`click` 8.2.0 broke compatibility in an unexpectingly violent way, removing previously public symbols without any transition period. Thus, the code may or may not type check, depending on which version of `click` is installed. We thus disable type checking or otherwise type check on a more coarse level whereever we used one of the now-removed symbols.
| ... | ... |
@@ -225,13 +225,26 @@ class CliRunner: |
| 225 | 225 |
if self._SUPPORTS_MIX_STDERR_ATTRIBUTE |
| 226 | 226 |
else {}
|
| 227 | 227 |
) |
| 228 |
- self.click_testing_clirunner = click.testing.CliRunner( |
|
| 228 |
+ # The "mix_stderr" argument, mandatory for our use case, was |
|
| 229 |
+ # removed in click 8.2.0 without a transition period. Since we |
|
| 230 |
+ # cannot branch on the click version available to the type |
|
| 231 |
+ # checker, we disable static type checking for this call in |
|
| 232 |
+ # particular; our test suite will have to uncover any breakage |
|
| 233 |
+ # dynamically instead. |
|
| 234 |
+ self.click_testing_clirunner = click.testing.CliRunner( # type: ignore[misc] |
|
| 229 | 235 |
**mix_stderr_args |
| 230 | 236 |
) |
| 231 | 237 |
|
| 232 | 238 |
def invoke( |
| 233 | 239 |
self, |
| 234 |
- cli: click.BaseCommand, |
|
| 240 |
+ # The click.BaseCommand abstract base class, previously the base |
|
| 241 |
+ # class of click.Command and click.Group, was removed in click |
|
| 242 |
+ # 8.2.0 without a transition period, and click.Command instated |
|
| 243 |
+ # as the common base class instead. To keep some degree of |
|
| 244 |
+ # compatibility with both old click and new click, we explicitly |
|
| 245 |
+ # list the (somewhat) concrete base classes we actually care |
|
| 246 |
+ # about here. |
|
| 247 |
+ cli: click.Command | click.Group, |
|
| 235 | 248 |
args: Sequence[str] | str | None = None, |
| 236 | 249 |
input: str | bytes | IO[Any] | None = None, |
| 237 | 250 |
env: Mapping[str, str | None] | None = None, |
| ... | ... |
@@ -71,7 +71,14 @@ def vault_config_exporter_shell_interpreter( # noqa: C901 |
| 71 | 71 |
/, |
| 72 | 72 |
*, |
| 73 | 73 |
prog_name_list: list[str] | None = None, |
| 74 |
- command: click.BaseCommand | None = None, |
|
| 74 |
+ # The click.BaseCommand abstract base class, previously the base |
|
| 75 |
+ # class of click.Command and click.Group, was removed in click |
|
| 76 |
+ # 8.2.0 without a transition period, and click.Command instated |
|
| 77 |
+ # as the common base class instead. To keep some degree of |
|
| 78 |
+ # compatibility with both old click and new click, we explicitly |
|
| 79 |
+ # list the (somewhat) concrete base classes we actually care |
|
| 80 |
+ # about here. |
|
| 81 |
+ command: click.Command | click.Group | None = None, |
|
| 75 | 82 |
runner: machinery.CliRunner | None = None, |
| 76 | 83 |
) -> Iterator[machinery.ReadableResult]: |
| 77 | 84 |
"""A rudimentary sh(1) interpreter for `--export-as=sh` output. |
| 78 | 85 |