MCPcopy Create free account
hub / github.com/python/mypy / format_func_def

Method format_func_def

mypy/stubutil.py:786–810  ·  view source on GitHub ↗
(
        self,
        sigs: list[FunctionSig],
        is_coroutine: bool = False,
        decorators: list[str] | None = None,
        docstring: str | None = None,
    )

Source from the content-addressed store, hash-verified

784 return default_type
785
786 def format_func_def(
787 self,
788 sigs: list[FunctionSig],
789 is_coroutine: bool = False,
790 decorators: list[str] | None = None,
791 docstring: str | None = None,
792 ) -> list[str]:
793 lines: list[str] = []
794 if decorators is None:
795 decorators = []
796
797 for signature in sigs:
798 # dump decorators, just before "def ..."
799 for deco in decorators:
800 lines.append(f"{self._indent}{deco}")
801
802 lines.append(
803 signature.format_sig(
804 indent=self._indent,
805 is_async=is_coroutine,
806 docstring=docstring,
807 include_docstrings=self._include_docstrings,
808 )
809 )
810 return lines
811
812 def format_type_args(self, o: TypeAliasStmt | FuncDef | ClassDef) -> str:
813 if not o.type_args:

Callers 2

visit_func_defMethod · 0.80

Calls 2

appendMethod · 0.80
format_sigMethod · 0.80

Tested by

no test coverage detected