Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

[REQ][python] get user's mypy check passing with warn_redundant_casts turned on #246

@nponsard

Description

@nponsard

Is your feature request related to a problem? Please describe.

I tried to run mypy on code generated by this project and got around 30 errors. The same happens when running mypy on the provided samples. There was an issue about that one year ago #1, is this a regression ?

Some errors I get on my project :

nethsm/client/components/schema/provision_request_data.py:76: error: Redundant cast to "str"  [redundant-cast]
nethsm/client/components/schema/provision_request_data.py:83: error: Redundant cast to "str"  [redundant-cast]
nethsm/client/paths/keys_generate/post/responses/response_201/__init__.py:19: error: Attributes without a default cannot follow attributes with one  [misc]
nethsm/client/paths/keys/post/responses/response_201/__init__.py:19: error: Attributes without a default cannot follow attributes with one  [misc]
nethsm/client/components/schema/public_key.py:78: error: Incompatible types in assignment (expression has type "str", variable has type "Union[Mapping[str, Union[dict[Any, Any], immutabledict[Any, Any], Mapping[str, object], list[Any], tuple[Any, ...], float, int, str, date, datetime, UUID, bool, None, bytes, io.FileIO, BufferedReader, nethsm.client.schemas.schema.FileIO]], KeyPublicDataDict, Unset]")  [assignment]

Describe the solution you'd like

That the generated code doesn't emit any type error with mypy.

Describe alternatives you've considered

I disabled type checking for the folder containing the generated code in my pyproject.toml :

[[tool.mypy.overrides]]
module = "nethsm.client.*"
ignore_errors = true

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