MCPcopy Index your code
hub / github.com/RustPython/RustPython / _format

Method _format

Lib/inspect.py:2770–2791  ·  view source on GitHub ↗
(self, *, quote_annotation_strings=True)

Source from the content-addressed store, hash-verified

2768 return self._format()
2769
2770 def _format(self, *, quote_annotation_strings=True):
2771 kind = self.kind
2772 formatted = self._name
2773
2774 # Add annotation and default value
2775 if self._annotation is not _empty:
2776 annotation = formatannotation(self._annotation,
2777 quote_annotation_strings=quote_annotation_strings)
2778 formatted = '{}: {}'.format(formatted, annotation)
2779
2780 if self._default is not _empty:
2781 if self._annotation is not _empty:
2782 formatted = '{} = {}'.format(formatted, repr(self._default))
2783 else:
2784 formatted = '{}={}'.format(formatted, repr(self._default))
2785
2786 if kind == _VAR_POSITIONAL:
2787 formatted = '*' + formatted
2788 elif kind == _VAR_KEYWORD:
2789 formatted = '**' + formatted
2790
2791 return formatted
2792
2793 __replace__ = replace
2794

Callers 2

__str__Method · 0.95
formatMethod · 0.45

Calls 3

formatannotationFunction · 0.85
reprFunction · 0.85
formatMethod · 0.45

Tested by

no test coverage detected