MCPcopy Index your code
hub / github.com/python/cpython / _format_args_and_kwargs

Function _format_args_and_kwargs

Lib/asyncio/format_helpers.py:30–48  ·  view source on GitHub ↗

Format function arguments and keyword arguments. Special case for a single parameter: ('hello',) is formatted as ('hello'). Note that this function only returns argument details when debug=True is specified, as arguments may contain sensitive information.

(args, kwargs, *, debug=False)

Source from the content-addressed store, hash-verified

28
29
30def _format_args_and_kwargs(args, kwargs, *, debug=False):
31 """Format function arguments and keyword arguments.
32
33 Special case for a single parameter: ('hello',) is formatted as ('hello').
34
35 Note that this function only returns argument details when
36 debug=True is specified, as arguments may contain sensitive
37 information.
38 """
39 if not debug:
40 return '()'
41
42 # use reprlib to limit the length of the output
43 items = []
44 if args:
45 items.extend(reprlib.repr(arg) for arg in args)
46 if kwargs:
47 items.extend(f'{k}={reprlib.repr(v)}' for k, v in kwargs.items())
48 return '({})'.format(', '.join(items))
49
50
51def _format_callback(func, args, kwargs, *, debug=False, suffix=''):

Callers 1

_format_callbackFunction · 0.85

Calls 5

extendMethod · 0.45
reprMethod · 0.45
itemsMethod · 0.45
formatMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…