Skip to content

Feature request: Expand nested unpacking and unpacking of single inline element #10592

@Avasam

Description

@Avasam

After running RUF005 in mhammond/pywin32#2230 , I was left with some nested unpacking
image

I feel like the following case should be detectable and flagged:

# from
foo(*{bar})
foo(*[bar])
foo(*(bar,))
foo(*[bar, *bar2])
foo(*(bar, *bar2))
foo(*[*bar2, bar])
foo(*(*bar2, bar))

# to
foo(bar)  # Not a safe fix from *{bar}
foo(bar)
foo(bar)
foo(bar, *bar2)
foo(bar, *bar2)
foo(*bar2, bar)
foo(*bar2, bar)

(same with assignments and possibly more cases I haven't thought of)

Edit: Removed sets since #10592 (comment)

Elements may be deduplicated and sets are unordered

Metadata

Metadata

Assignees

No one assigned

    Labels

    ruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions