class ucca.core.ModifyPassage(fn)[source]

Bases: object

Decorator for changing a Passage or any member of it.

This decorator is mandatory for anything which causes the elements in a Passage to change by adding or removing an element, or changing an attribute.

It validates that the Passage is not frozen before allowing the change.

The decorator can’t be used for __init__ calls, as at the stage of the check there are no instance attributes to check. So in such cases, a function that binds the object created with the Passage should be decorated instead (and should be called after the instance attributes are set).

fn: the function object to decorate

Methods Summary

__call__(*args, **kwargs) Decorating functions which modify Passage elements.

Methods Documentation

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

Decorating functions which modify Passage elements.

  • args – list of all arguments, assuming the first is the object which modifies Passage, and it has an attribute root which points to the Passage it is part of.
  • kwargs – list of all keyword arguments

The decorated function result.


FrozenPassageError – if the Passage is frozen and can’t be modified.