Skip to content

fix: type errors in cli/testflinger_cli/auth.py detected by mypy #1028

@Ahmedaltu

Description

@Ahmedaltu

Running mypy on cli/testflinger_cli/auth.py reveals 4 type errors:
cli/testflinger_cli/auth.py:79: error: Missing return statement [return]
cli/testflinger_cli/auth.py:91: error: Missing return statement [return]
cli/testflinger_cli/auth.py:126: error: Argument "fallback" to "get" of "ConfigParser" has incompatible type "None"; expected "str" [arg-type]
cli/testflinger_cli/auth.py:180: error: Argument 1 has incompatible type "str | None"; expected "str | bytes" [arg-type]

Proposed fixes:

  • Lines 79 and 91: add return None after _handle_auth_error() calls — both methods declare str as return type but have a path that returns nothing
  • Line 126: change fallback=None to fallback="" — ConfigParser.get() expects str, not None
  • Line 180: change self.jwt_token to self.jwt_token or "" in jwt.decode() call — jwt_token can be str | None but jwt.decode expects str | bytes

Happy to submit a PR with these fixes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions