MCPcopy
hub / github.com/deadc0de6/dotdrop / Action

Class Action

dotdrop/action.py:111–146  ·  view source on GitHub ↗

An action to execute

Source from the content-addressed store, hash-verified

109
110
111class Action(Cmd):
112 """An action to execute"""
113
114 pre = 'pre'
115 post = 'post'
116 descr = 'action'
117
118 def __init__(self, key, kind, action):
119 """constructor
120 @key: action key
121 @kind: type of action (pre or post)
122 @action: action string
123 """
124 super().__init__(key, action)
125 self.kind = kind
126 self.args = []
127
128 def copy(self, args):
129 """return a copy of this object with arguments"""
130 action = Action(self.key, self.kind, self.action)
131 action.args = args
132 return action
133
134 @classmethod
135 def parse(cls, key, value):
136 """parse key value into object"""
137 val = {}
138 val['kind'], val['action'] = value
139 return cls(key=key, **val)
140
141 def __str__(self):
142 out = f'{self.key}: [{self.kind}] \"{self.action}\"'
143 return out
144
145 def __repr__(self):
146 return f'action({self.__str__()})'
147
148
149class Transform(Cmd):

Callers 2

test_installMethod · 0.90
copyMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_installMethod · 0.72