mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-11 23:25:09 +00:00
![]() ## Summary Part of https://github.com/astral-sh/ruff/issues/15382 This PR implements a general callable type that wraps around a `Signature` and it uses that new type to represent `typing.Callable`. It also implements `Display` support for `Callable`. The format is as: ``` ([<arg name>][: <arg type>][ = <default type>], ...) -> <return type> ``` The `/` and `*` separators are added at the correct boundary for positional-only and keyword-only parameters. Now, as `typing.Callable` only has positional-only parameters, the rendered signature would be: ```py Callable[[int, str], None] # (int, str, /) -> None ``` The `/` separator represents that all the arguments are positional-only. The relationship methods that check assignability, subtype relationship, etc. are not yet implemented and will be done so as a follow-up. ## Test Plan Add test cases for display support for `Signature` and various mdtest for `typing.Callable`. |
||
---|---|---|
.. | ||
visitor | ||
comparable.rs | ||
docstrings.rs | ||
expression.rs | ||
generated.rs | ||
helpers.rs | ||
identifier.rs | ||
int.rs | ||
lib.rs | ||
name.rs | ||
node.rs | ||
nodes.rs | ||
operator_precedence.rs | ||
parenthesize.rs | ||
python_version.rs | ||
relocate.rs | ||
script.rs | ||
statement_visitor.rs | ||
stmt_if.rs | ||
str.rs | ||
str_prefix.rs | ||
traversal.rs | ||
types.rs | ||
visitor.rs | ||
whitespace.rs |