Il mar 17 giu 2025, 09:49 Markus Armbruster <arm...@redhat.com> ha scritto:
> pylint isn't happy with the new module: > Fixed, will post a new version. Can I pick your brain on whether to focus on Rust<->QObject conversion or give the Rust structs the full visitor treatment? (See other messages in reply to the cover letter). Paolo ************* Module qapi.rs_types > scripts/qapi/rs_types.py:286:4: W0237: Parameter 'branches' has been > renamed to 'variants' in overriding > 'QAPISchemaGenRsTypeVisitor.visit_object_type' method (arguments-renamed) > scripts/qapi/rs_types.py:307:4: W0237: Parameter 'alternatives' has been > renamed to 'variants' in overriding > 'QAPISchemaGenRsTypeVisitor.visit_alternate_type' method (arguments-renamed) > scripts/qapi/rs_types.py:316:67: W0613: Unused argument 'builtins' > (unused-argument) > scripts/qapi/rs_types.py:9:0: W0611: Unused POINTER_SUFFIX imported from > common (unused-import) > scripts/qapi/rs_types.py:10:0: W0611: Unused rs_ctype_parse imported from > rs (unused-import) > scripts/qapi/rs_types.py:18:0: W0611: Unused QAPISchemaEnumType imported > from schema (unused-import) > scripts/qapi/rs_types.py:18:0: W0611: Unused QAPISchemaType imported from > schema (unused-import) > > > Might be too early to bother with the type hints, but here goes anyway: > > $ mypy scripts/qapi-gen.py > scripts/qapi/schema.py:70: error: Argument 1 to "rsgen_ifcond" has > incompatible type "str | dict[str, object] | None"; expected "str | > dict[str, Any]" [arg-type] > scripts/qapi/rs.py:99: error: Incompatible types in assignment (expression > has type "str | None", variable has type "dict[str, str]") [assignment] > scripts/qapi/rs.py:103: error: Unsupported left operand type for + > ("None") [operator] > scripts/qapi/rs.py:103: note: Left operand is of type "str | None" > scripts/qapi/rs.py:103: error: Incompatible types in assignment > (expression has type "str | Any", variable has type "dict[str, str]") > [assignment] > scripts/qapi/rs.py:106: error: Incompatible types in assignment > (expression has type "str", variable has type "dict[str, str]") > [assignment] > scripts/qapi/rs.py:108: error: Incompatible types in assignment > (expression has type "str", variable has type "dict[str, str]") > [assignment] > scripts/qapi/rs.py:110: error: Incompatible types in assignment > (expression has type "str", variable has type "dict[str, str]") > [assignment] > scripts/qapi/rs.py:111: error: Incompatible return value type (got > "dict[str, str]", expected "str") [return-value] > scripts/qapi/rs_types.py:47: error: Item "None" of "QAPISchemaVariants | > None" has no attribute "tag_member" [union-attr] > scripts/qapi/rs_types.py:49: error: Item "None" of "QAPISchemaVariants | > None" has no attribute "variants" [union-attr] > scripts/qapi/rs_types.py:84: error: Item "None" of "QAPISchemaVariants | > None" has no attribute "variants" [union-attr] > scripts/qapi/rs_types.py:116: error: Incompatible default for argument > "exclude" (default has type "None", argument has type "list[str]") > [assignment] > scripts/qapi/rs_types.py:116: note: PEP 484 prohibits implicit Optional. > Accordingly, mypy has changed its default to no_implicit_optional=True > scripts/qapi/rs_types.py:116: note: Use > https://github.com/hauntsaninja/no_implicit_optional to automatically > upgrade your codebase > scripts/qapi/rs_types.py:118: error: Incompatible return value type (got > "list[str]", expected "str") [return-value] > scripts/qapi/rs_types.py:251: error: Item "None" of "QAPISchemaVariants | > None" has no attribute "variants" [union-attr] > scripts/qapi/rs_types.py:309: error: Argument 2 of "visit_alternate_type" > is incompatible with supertype "QAPISchemaVisitor"; supertype defines the > argument type as "QAPISourceInfo | None" [override] > scripts/qapi/rs_types.py:309: note: This violates the Liskov substitution > principle > scripts/qapi/rs_types.py:309: note: See > https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides > Found 15 errors in 3 files (checked 1 source file) > >