Skip to content

Possible error in PLE0605 #7672

@nstarman

Description

@nstarman

In astropy/astropy#15385 we are trying to fix some __all__ statements and ran into the following

__all__ = [...]
logging_levels = ["NOTSET", ...]
...
__all__ += logging_levels

My suggested fix was

__all__ = [...]
__all__ += (logging_levels := ["NOTSET", ...])

However PLE0605 is still complaining. I don't think this is correct since the above should be, from the "perspective" of __all__ equivalent to

__all__ = [...]
__all__ += ["NOTSET", ...]

which passes the check.

The inclusion of the walrus operator for assigning to another variable makes the AST more complicated but should be equivalent statically to excluding the walrus.

Metadata

Metadata

Assignees

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