MCPcopy Index your code
hub / github.com/python/mypy / format_callable_args

Function format_callable_args

mypy/messages.py:2621–2640  ·  view source on GitHub ↗

Format a bunch of Callable arguments into a string

(
    arg_types: list[Type],
    arg_kinds: list[ArgKind],
    arg_names: list[str | None],
    format: Callable[[Type], str],
    verbosity: int,
)

Source from the content-addressed store, hash-verified

2619
2620
2621def format_callable_args(
2622 arg_types: list[Type],
2623 arg_kinds: list[ArgKind],
2624 arg_names: list[str | None],
2625 format: Callable[[Type], str],
2626 verbosity: int,
2627) -> str:
2628 """Format a bunch of Callable arguments into a string"""
2629 arg_strings = []
2630 for arg_name, arg_type, arg_kind in zip(arg_names, arg_types, arg_kinds):
2631 if should_format_arg_as_type(arg_kind, arg_name, verbosity):
2632 arg_strings.append(format(arg_type))
2633 else:
2634 constructor = ARG_CONSTRUCTOR_NAMES[arg_kind]
2635 if arg_kind.is_star() or arg_name is None:
2636 arg_strings.append(f"{constructor}({format(arg_type)})")
2637 else:
2638 arg_strings.append(f"{constructor}({format(arg_type)}, {repr(arg_name)})")
2639
2640 return ", ".join(arg_strings)
2641
2642
2643def format_type_inner(

Callers 1

format_type_innerFunction · 0.85

Calls 7

zipFunction · 0.85
formatFunction · 0.85
reprFunction · 0.85
appendMethod · 0.80
is_starMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…