chore: fix mypy issues in distros modules - #7060
Open
sshedi wants to merge 6 commits into
Open
Conversation
holmanb
requested changes
Sep 1, 2026
sshedi
force-pushed
the
fix-mypy-distros-modules
branch
from
September 1, 2026 16:45
4904ced to
a51d559
Compare
Add assert guards after parse() calls to narrow self._contents from Optional to non-None, and split the StringIO/str variable in __str__ to satisfy mypy's type assignment checks. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Shreenidhi Shedi <shreenidhi.shedi@broadcom.com>
Add assert guards to narrow self._contents from Optional to non-None before each access in __str__, _retr_option, add_nameserver, _remove_option, and add_search_domain. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Shreenidhi Shedi <shreenidhi.shedi@broadcom.com>
Annotate nconf as Dict[str, Any] in generate_fallback_config so mypy can resolve the value type of the mixed-type dict and allow .append(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Shreenidhi Shedi <shreenidhi.shedi@broadcom.com>
Annotate _preferred_ntp_clients in the base Distro class as Optional[List[str]] so mypy allows list assignments in preferred_ntp_clients properties in both the base class and subclasses such as OpenSUSE. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Shreenidhi Shedi <shreenidhi.shedi@broadcom.com>
Add @classmethod to shutdown_command to match base class signature, rename first parameter to cls in manage_service (already a classmethod). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Shreenidhi Shedi <shreenidhi.shedi@broadcom.com>
Declare network_conf_fn as Dict[str, str] at class level to shadow rhel.Distro's str type, allowing dict assignment and indexing in __init__. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Shreenidhi Shedi <shreenidhi.shedi@broadcom.com>
sshedi
force-pushed
the
fix-mypy-distros-modules
branch
from
September 4, 2026 14:51
a51d559 to
2b36b9d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Commit Message
Additional Context
Test Steps
Merge type