pg.typing.PresetArgValue

Accessible via pg.typing.PresetArgValue.

class PresetArgValue(default=MISSING_VALUE)[source]

Bases: pg.Formattable

Value placeholder for arguments whose value will be provided by presets.

Example

def foo(x, y=pg.PresetArgValue(default=1))

return x + y

with pg.preset_args(y=2):

print(foo(x=1)) # 3: y=2

print(foo(x=1)) # 2: y=1

Methods:

format(*args, **kwargs)

Formats this object into a string representation.

inspect(func)

Gets the PresetArgValue specified in a function's signature.

resolve_args(call_args, call_kwargs, ...[, ...])

Resolves calling arguments passed to a method with presets.

format(*args, **kwargs)[source]

Formats this object into a string representation.

Parameters:
  • compact – If True, this object will be formatted into a single line.

  • verbose – If True, this object will be formatted with verbosity. Subclasses should define verbosity on their own.

  • root_indent – The start indent level for this object if the output is a multi-line string.

  • **kwargs – Subclass specific keyword arguments.

Returns:

A string of formatted object.

classmethod inspect(func)[source]

Gets the PresetArgValue specified in a function’s signature.

Return type:

Dict[str, pg.typing.PresetArgValue]

classmethod resolve_args(call_args, call_kwargs, positional_arg_names, arg_defaults, preset_kwargs, include_all_preset_kwargs=False)[source]

Resolves calling arguments passed to a method with presets.

Return type:

Tuple[Sequence[Any], Dict[str, Any]]