Skip to content

WPS366 false positive on strict or None #3610

@sobolevn

Description

@sobolevn

Here's the code I have in django-modern-rest:

def from_python(
    unstructured: Any,
    model: Any,
    *,
    strict: bool | None,
) -> Any:
    return msgspec.convert(
        unstructured,
        model,
        strict=strict or False,
    )

strict or False trigger WPS366, however, it is not correct. False is the default boolen value, when None is passed.

@j2cry this is a bug in 1.6.0
Are you interested in fixing this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions