vpype_cli._DeferredEvaluator#

class _DeferredEvaluator(text: str, param_name: str, *args, **kwargs)#

Abstract base-class for deferred evaluation of command parameters.

Click parses all command arguments and options before running the corresponding command functions. In contrast, property substitution must be performed just just before a command is executed, since it depends on the current context (e.g. currently defined properties and current layer ID).

To address this issue, sub-classes of click.ParamType may return some _DeferredEvaluator instance instead of directly converting the user input. The command decorators (e.g. generator() and friends) will detect such instances, perform the conversion, and forward the converted value to the command function.

Methods

evaluate

Sub-class must override this function and return the converted value of self._text

Attributes

Parameters:
  • text (str) --

  • param_name (str) --

Methods#

abstract _DeferredEvaluator.evaluate(state: State) Any#

Sub-class must override this function and return the converted value of self._text

Parameters:

state (State) --

Return type:

Any

Attributes#

_DeferredEvaluator._abc_impl = <_abc._abc_data object>#