Skip to content

Y011 doesn't account for module-qualified values #533

@donbarbos

Description

@donbarbos

Y011 appears to behave inconsistently when assigning a default value using = some_value or = module.some_value. In the first case it raises an error, while in the second it does not.

For example, this can be reproduced when trying to set a default value for email.parser.Parser.__init__ in typeshed (that's how I encountered it):

# error appears:
from email._policybase import compat32
def __init__(..., policy = compat32) ...
# error doesn't appear:
from email import _policybase
def __init__(..., policy = _policybase.compat32) ...

As far as I know, the documentation does not mention that these two cases should be treated differently, so I wanted to report it in case this behavior is unintended.

Metadata

Metadata

Assignees

No one assigned

    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