System argument vector interpretation methods.
legacy is the only implemented method and should cover most use cases.
Events
UsageViolation0
Exception signalling that options were not properly expressed.
UsageViolationProperties
UsageViolation__init__
__init__(self, mismatch, origin, option)
UsageViolation__str__30%
__str__(self)
legacy1179%
legacy(restricted, required, options, trap, offset, signal, assignment)
Interpret an argument vector, options, according to the restricted and required option indexes. Identified signals are translated into events describing the expected operation, target slot, and value to be processed by a configuration context.
The produced events are terminated by a 'remainder' event containing the excess fields that could not be translated. If all fields were processed as options, the remainder will be an empty list.
In the case of an error, the event prior to the remainder will be identified as a mismatch operation with the slot identifying the option that failed to match an index entry.
legacyParameters
_sfr0
_sfr(t, k, i, v)
_seq0
_seq(t, k, i, v)
operations0
operations = {
'field-replace': (lambda t, k, i, v: t.__setitem__(k, i(k, v))),
'sequence-append': (lambda t, k, i, v: t[k].append(i(k, v))),
'set-add': (lambda t, k, i, v: t[k].add(i(k, v))),
'set-discard': (lambda t, k, i, v: t[k].discard(i(k, v))),
'integer-add': (lambda t, k, i, v: t.__setitem__(k, t.get(k, 0) + int(i(k, v)))),
'subfield-replace': _sfr,
'sequence-append-assignment': _seq,
}
merge191%
merge(target, events, Interpreter, Operations)
Apply the values provided by events into target using the event's operation to select the merge method provided in Operations.
mergeParameters
targetThe object that the interpreted options and arguments are being inserted into. A configuration dictionary.
eventsAn iterable producing recognized option events. Normally, constructed by legacy.
InterpreterA function called with the slot being assigned and value that needs to be interpreted prior to the storage operation.
Defaults to a reflection of the given value(no-op).
OperationsA mapping designating how an assignment operation is to be performed against the target.
Defaults to operations.