MCPcopy
hub / github.com/python/mypy / format_type

Function format_type

mypy/messages.py:2950–2963  ·  view source on GitHub ↗

Convert a type to a relatively short string suitable for error messages. `verbosity` is a coarse-grained control on the verbosity of the type This function returns a string appropriate for unmodified use in error messages; this means that it will be quoted in most cases. If m

(
    typ: Type, options: Options, verbosity: int = 0, module_names: bool = False
)

Source from the content-addressed store, hash-verified

2948
2949
2950def format_type(
2951 typ: Type, options: Options, verbosity: int = 0, module_names: bool = False
2952) -> str:
2953 """
2954 Convert a type to a relatively short string suitable for error messages.
2955
2956 `verbosity` is a coarse-grained control on the verbosity of the type
2957
2958 This function returns a string appropriate for unmodified use in error
2959 messages; this means that it will be quoted in most cases. If
2960 modification of the formatted string is required, callers should use
2961 format_type_bare.
2962 """
2963 return quote_type_string(format_type_bare(typ, options, verbosity, module_names))
2964
2965
2966def format_type_bare(

Callers 15

check_func_defMethod · 0.90
visit_expression_stmtMethod · 0.90
format_expr_typeMethod · 0.90
get_expr_nameMethod · 0.90
check_for_truthy_typeMethod · 0.90
split_for_callableMethod · 0.90
anal_typeMethod · 0.90
expr_typeMethod · 0.90
check_non_paramspecMethod · 0.90

Calls 2

quote_type_stringFunction · 0.85
format_type_bareFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…