Skip to content

Conversation

@allenrobel
Copy link
Collaborator

@allenrobel allenrobel commented Nov 15, 2025

Address tech debt within BootflashFiles

NOTE: This PR cannot be completed until #553 is merged.

Summary

  1. Add type-hints

  2. Remove class decorators and replace with local properties for RestSend and Results

  3. Add pylint directive to suppress invalid-name

  4. black reformatting lines for more relaxed line length

  5. refresh_switch_details(), simplify

  6. Add two methods to verify proper instantiation of rest_send and switch_details

  • _rest_send_instantiated
  • _switch_details_instantiated
  1. add_file_to_existing_payload(), simplify logic

  2. test_bootflash_files.py

  • Update all unit tests to reflect changes to BootflashFiles.
  • Some unit-tests started to fail because item 2 improved detection of improperly-validated RestSend and SwitchDetails. These tests were fixed. Mainly this had to do with switch_details.rest_send not being set.

This commit addresses tech debt in class BootflashFile.

The main changes are:

- Remove class decorators in favor of class properties
- Simplify logic in refresh_switch_details
- Update unit-tests to align with changes

Details

1. Remove class decorators

1a. Properties.add_rest_send
1b. Properties.add_results

2. Remove import for Properties

3. Add class properties for RestSend and Results

4. Import Results and RestSend for use in validation in their respective properties

5. import Typing.Literal for use in rest_send and results properties.

6. BootflashFiles.refresh_switch_details

6a. Diff lines 150-168, because rest_send validation occurs in the setter and getter, we can remove validation from refresh_switch_details and simplify this method.

7. test_bootflash_files.py

7a. test_bootflash_files_00000

- add asserts for rest_send and results

7b. test_bootflash_files_00100

- modify assert for earlier validation of rest_send

7c. test_bootflash_files_00110. modify assert for earlier validation of rest_send

7c. test_bootflash_files_00120. Remove. Results() is now initialized in BootflashFiles.__init__()
No functional changes in this commit.

1. Add pylint directive to suppress invalid-name

2 black reformating lines for more relaxed line length
No functional changs in this commit.
No functional changes in this commit

1. Add pylint directive to suppress invalid-name

2 black reformating lines for more relaxed line length
1. Add type-hints

2. Add two methods to verify proper instantiation of rest_send and switch_details

- _rest_send_instantiated
- _switch_details_instantiated

3. add_file_to_existing_payload

- Simplify logic

4. test_bootflash_files.py

- Update all unit tests to reflect changes to BootflashFiles.

- Some unit-tests started to fail because item 2 improved detection of improperly-validated RestSend and SwitchDetails.  These tests were fixed.  Mainly this had to do with switch_details.rest_send not being set.
@allenrobel allenrobel self-assigned this Nov 15, 2025
@allenrobel allenrobel added the hold Do not merge for reason(s) explained in the PR label Nov 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold Do not merge for reason(s) explained in the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants