Skip to content

refactor: fix implicit Optional type hints in utils.py#2482

Open
tusharynayaka wants to merge 3 commits intoborgbase:masterfrom
tusharynayaka:master
Open

refactor: fix implicit Optional type hints in utils.py#2482
tusharynayaka wants to merge 3 commits intoborgbase:masterfrom
tusharynayaka:master

Conversation

@tusharynayaka
Copy link
Copy Markdown

  1. Description:
    This PR resolves Mypy errors regarding implicit Optional type hints in src/vorta/utils.py. In accordance with PEP 484 and modern Mypy standards, arguments that default to None now use explicit Optional[...] or | None syntax. This ensures the codebase remains compatible with strict static analysis.

  2. Related Issue:
    Relates to GSoC 2026 Project: "Add comprehensive type annotations."

  3. Motivation and Context:
    Implicit Optional types are no longer supported by recent versions of Mypy. By making these types explicit, we improve code clarity and prevent potential NoneType attribute errors during development. This is a foundational step toward full type-check compliance for the project.

  4. How Has This Been Tested?
    Static Analysis: Verified the module using mypy.

  5. Unit Tests: Ran the dedicated utility test suite.

  6. Command: pytest tests/unit/test_utils.py -k "not keyring and not system_tray"

  7. Results: 26 tests passed successfully.

  8. Environment: WSL (Ubuntu 24.04), Python 3.12.3.

  9. Types of changes
    [x] Bug fix (non-breaking change which fixes an issue)

  10. Checklist:
    [x] I have read the guide.
    [x] My code follows the code style of this project.
    [x] My change requires a change to the documentation.
    [x] I have updated the documentation accordingly.
    [x] I have added tests to cover my changes.
    [x] All new and existing tests passed.

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.

1 participant