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

Method pyannotate_signature

mypy/suggestions.py:744–752  ·  view source on GitHub ↗

Format a callable type as a pyannotate dict

(
        self, cur_module: str | None, is_method: bool, typ: CallableType
    )

Source from the content-addressed store, hash-verified

742 return json.dumps([obj], sort_keys=True)
743
744 def pyannotate_signature(
745 self, cur_module: str | None, is_method: bool, typ: CallableType
746 ) -> PyAnnotateSignature:
747 """Format a callable type as a pyannotate dict"""
748 start = int(is_method)
749 return {
750 "arg_types": [self.format_type(cur_module, t) for t in typ.arg_types[start:]],
751 "return_type": self.format_type(cur_module, typ.ret_type),
752 }
753
754 def format_signature(self, sig: PyAnnotateSignature) -> str:
755 """Format a callable type in a way suitable as an annotation... kind of"""

Callers 1

get_suggestionMethod · 0.95

Calls 2

format_typeMethod · 0.95
intClass · 0.85

Tested by

no test coverage detected