Skip to content

mypy issues #52

@aldbr

Description

@aldbr

Dear developers,

  1. mypy is complaining about the KeySetSerialization type:
error: Argument 1 to "import_key_set" of "KeySet" has incompatible type "dict[Any, Any]"; expected "KeySetSerialization"  [arg-type]

I should likely import it from https://github.com/authlib/joserfc/blob/main/src/joserfc/_keys.py but this looks like a private module and KeySetSerialization does not seem to be part of the exported members:

__all__ = [
"OctKey",
"RSAKey",
"ECKey",
"OKPKey",
"Key",
"KeySet",
"JWKRegistry",
]

Is that expected?

  1. mypy is also complaining about the get method in https://github.com/authlib/joserfc/blob/main/src/joserfc/rfc7517/models.py when we set the default value as []:
key_ops = key.get("key_ops", [])
error: Argument 2 to "get" of "BaseKey" has incompatible type "list[Never]"; expected "str | None"  [arg-type]

It's because the expected type of default does not include list (only str or None), is that expected?

def get(self, k: str, default: str | None = None) -> str | list[str] | None:

I can open a PR to perform the changes I am describing here if required.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions