Skip to content

refactor: make BaseCmdResult and subclasses generic to eliminate runtime type narrowing - #492

Merged
glehmann merged 2 commits into
masterfrom
gln/generic-command-results-nlwv
May 11, 2026
Merged

refactor: make BaseCmdResult and subclasses generic to eliminate runtime type narrowing#492
glehmann merged 2 commits into
masterfrom
gln/generic-command-results-nlwv

Conversation

@glehmann

@glehmann glehmann commented Apr 21, 2026

Copy link
Copy Markdown
Member

Use generic type parameters to express that SSHResult and LocalCommandResult
return specific output types (str or bytes) based on the decode parameter,
removing the need for isinstance checks in calling code.

Signed-off-by: Gaëtan Lehmann gaetan.lehmann@vates.tech

This PR is part of a complex set of PRs containing 6 PRs:

  1. master
  2. Use passlib in place of legacycrypt #396master
  3. Introduce TOML-based configuration to replace data.py #491Use passlib in place of legacycrypt #396
  4. "refactor: make BaseCmdResult and subclasses generic to eliminate runtime type narrowing" (this PR) → master
  5. misc type related enhancements #460refactor: make BaseCmdResult and subclasses generic to eliminate runtime type narrowing #492
  6. Add ty type checker configuration #476misc type related enhancements #460
  7. Add Docker-based compatibility test kit for external validation #431refactor: make BaseCmdResult and subclasses generic to eliminate runtime type narrowing #492, Use passlib in place of legacycrypt #396

@olivierh-pro
olivierh-pro requested a review from a team April 29, 2026 13:09
glehmann and others added 2 commits May 11, 2026 17:41
…ime type narrowing

Use generic type parameters to express that SSHResult and LocalCommandResult
return specific output types (str or bytes) based on the decode parameter,
removing the need for isinstance checks in calling code.

Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
Signed-off-by: Vincent Michel <vincent.michel@vates.tech>
@glehmann
glehmann force-pushed the gln/generic-command-results-nlwv branch from c1989ab to 55de4c6 Compare May 11, 2026 15:41
@glehmann
glehmann merged commit c7a0a1c into master May 11, 2026
9 checks passed
@glehmann
glehmann deleted the gln/generic-command-results-nlwv branch May 11, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants