Skip to content

Conversation

@allenrobel
Copy link
Collaborator

@allenrobel allenrobel commented Nov 14, 2025

This commit addresses technical debt in the main dcnm_bootflash.py module.

  1. Adds type hints
  2. Removes class decorator @Properties.add_rest_send in favor of a class property for RestSend
  3. Run black linter which caused formatting changes due to relaxation of line-length constraints

Per Copilot's review comments, I'm modifying the claim that "no functional changes" exist in this PR. In fact, the changes in this PR introduce subtle (but desired) behavioral changes.

These changes are related to:

  1. Handling of "falsey" values (e.g. "", []) vs None. Since we are type-hinting and instantiating variables to str, list, etc, rather than e.g. Union[str, None], our conditionals need to change accordingly.

  2. A small "fix" related to handling the case where task is None in the error path in main().

No functional changes in this commit.

This commit adds type hints and removes class decorator @Properties.add_rest_send in favor of a class property for RestSend.
@allenrobel allenrobel self-assigned this Nov 14, 2025
No functional changes in this commit.

Run linters to fix Ansible sanity tests for dcnm_bootflash.py
@allenrobel allenrobel requested a review from Copilot November 14, 2025 17:37
Copilot finished reviewing on behalf of allenrobel November 14, 2025 17:40
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds type hints to the dcnm_bootflash module and replaces the @Properties.add_rest_send decorator with an explicit rest_send property implementation. However, contrary to the claim of "no functional changes," the PR introduces several behavioral changes in validation logic and error handling.

Key Changes

  • Added type hints throughout Common, Deleted, and Query classes
  • Replaced @Properties.add_rest_send decorator with explicit property getter/setter for rest_send
  • Changed _rest_send initialization from None to RestSend({})
  • Modified validation checks from is None comparisons to truthiness checks (not)
  • Added error handling for task is None case in main()

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
plugins/modules/dcnm_bootflash.py Added comprehensive type hints to all classes and methods; replaced decorator with explicit rest_send property; modified validation logic from is None to not checks; added error handling in main()
tests/unit/modules/dcnm/dcnm_bootflash/test_bootflash_common.py Updated test assertions to verify RestSend({}) initialization instead of None; added import for RestSend
tests/unit/modules/dcnm/dcnm_bootflash/test_bootflash_deleted.py Updated test assertions to verify RestSend({}) initialization instead of None
tests/unit/modules/dcnm/dcnm_bootflash/test_bootflash_query.py Updated test assertions to verify RestSend({}) initialization instead of None

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

1. Address Copilot review commit regarding unused import.

2. Run black linter

3. Add pylint directive to suppress invalid-name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review PR is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants