mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-08 01:20:29 +00:00

Some checks are pending
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Blocked by required conditions
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz (push) Blocked by required conditions
CI / Fuzz the parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
## Summary Closes https://github.com/astral-sh/ruff/issues/14231.
58 lines
776 B
Python
58 lines
776 B
Python
from typing import Generic, TypeVarTuple, Unpack
|
|
|
|
Shape = TypeVarTuple("Shape")
|
|
|
|
|
|
class C(Generic[Unpack[Shape]]):
|
|
pass
|
|
|
|
|
|
class D(Generic[Unpack[Shape]]):
|
|
pass
|
|
|
|
|
|
def f(*args: Unpack[tuple[int, ...]]):
|
|
pass
|
|
|
|
|
|
def f(*args: Unpack[other.Type]):
|
|
pass
|
|
|
|
|
|
def f(*args: Generic[int, Unpack[int]]):
|
|
pass
|
|
|
|
|
|
# Valid syntax, but can't be unpacked.
|
|
def f(*args: Unpack[int | str]) -> None:
|
|
pass
|
|
|
|
|
|
def f(*args: Unpack[int and str]) -> None:
|
|
pass
|
|
|
|
|
|
def f(*args: Unpack[int > str]) -> None:
|
|
pass
|
|
|
|
|
|
from typing import TypedDict
|
|
|
|
|
|
class KwargsDict(TypedDict):
|
|
x: int
|
|
y: int
|
|
|
|
|
|
# OK
|
|
def f(name: str, /, **kwargs: Unpack[KwargsDict]) -> None:
|
|
pass
|
|
|
|
|
|
# OK
|
|
def f() -> object:
|
|
return Unpack[tuple[int, ...]]
|
|
|
|
|
|
# OK
|
|
def f(x: Unpack[int]) -> object: ...
|