trestle.core.commands.remove
trestle.core.commands.remove
¤
Trestle Remove Command.
Attributes¤
logger = logging.getLogger(__name__)
module-attribute
¤
Classes¤
RemoveCmd
¤
Bases: CommandPlusDocs
Remove a subcomponent from an existing model.
Source code in trestle/core/commands/remove.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
|
Attributes¤
name = 'remove'
class-attribute
instance-attribute
¤
Functions¤
remove(element_path, parent_element)
classmethod
¤
For the element_path, remove a model from the parent_element of a given parent_model.
First we check if there is an existing element at that path If not, we complain. Then we set up an action plan to update the model (specified by file_path) in memory, return the action and return the parent_element.
LIMITATIONS: 1. This does not remove elements of a list or dict. Instead, the entire list or dict is removed. 2. This cannot remove arbitrarily named elements that are not specified in the schema. For example, "responsible-parties" contains named elements, e.g., "organisation". The tool will not remove the "organisation" as it is not in the schema, but one can remove its elements, e.g., "party-uuids".
Source code in trestle/core/commands/remove.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
|
handler: python