Skip to content

Commit b0be867

Browse files
committed
Starting changes to implement session stack
1 parent c64dcc1 commit b0be867

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

ActionNode.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def _populate_subnodes(self):
3232
action_parent = NodePath.create_path(self, field.path.base_path)
3333
action_parent.append(new_action, field.path.base_name)
3434

35-
def __call__(self, target: Node, *arguments):
35+
def __call__(self, target: NodePath, *arguments):
3636
callback = self.get()
3737
if callback is None:
3838
raise NotImplementedError('__call__ method not overridden or no callback provided')

CommandInterpreter.py

-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ def evaluate(self, part):
1717
if isinstance(part, Command):
1818
return self.execute(part)
1919
return part
20-

Session.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def start(self):
88
def finish(self):
99
pass
1010

11-
def execute(self, target: NodePath, action, *arguments):
11+
def execute(self, target: NodePath, action: str, *arguments):
1212
raise NotImplementedError("Session.execute method was not overridden")
1313

1414
def get(self, target: NodePath):

actions/BasicActions.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -5,60 +5,60 @@ class GetAction(ActionNode):
55
def __init__(self):
66
super().__init__(path='get')
77

8-
def __call__(self, target: Node):
8+
def __call__(self, target: NodePath):
99
return target.get()
1010

1111

1212
class SetAction(ActionNode):
1313
def __init__(self):
1414
super().__init__(path='set')
1515

16-
def __call__(self, target: Node, new_value):
16+
def __call__(self, target: NodePath, new_value):
1717
target.set(new_value)
1818

1919

2020
class ExistsAction(ActionNode):
2121
def __init__(self):
2222
super().__init__(path='exists')
2323

24-
def __call__(self, target: Node, node_name: str) -> bool:
24+
def __call__(self, target: NodePath, node_name: str) -> bool:
2525
return target.contains(node_name)
2626

2727

2828
class CreateAction(ActionNode):
2929
def __init__(self):
3030
super().__init__(path='create')
3131

32-
def __call__(self, target: Node, name: str, value=None):
32+
def __call__(self, target: NodePath, name: str, value=None):
3333
target.append(Node(value), name)
3434

3535

3636
class RemoveAction(ActionNode):
3737
def __init__(self):
3838
super().__init__(path='remove')
3939

40-
def __call__(self, target: Node, node_name: str):
40+
def __call__(self, target: NodePath, node_name: str):
4141
target.remove(node_name)
4242

4343

4444
class ListAction(ActionNode):
4545
def __init__(self):
4646
super().__init__(path='list')
4747

48-
def __call__(self, target: Node):
48+
def __call__(self, target: NodePath):
4949
# TODO: use link to list.nodes
5050
return self.list_nodes(target)
5151

5252
@action(path='all')
53-
def list_all(self, target: Node):
53+
def list_all(self, target: NodePath):
5454
return target.list()
5555

5656
@action(path='nodes')
57-
def list_nodes(self, target: Node):
57+
def list_nodes(self, target: NodePath):
5858
return [n for n in target.list() if not ListAction._is_attribute(n)]
5959

6060
@action(path='attributes')
61-
def list_attributes(self, target: Node):
61+
def list_attributes(self, target: NodePath):
6262
return [n for n in target.list() if ListAction._is_attribute(n)]
6363

6464
@staticmethod

0 commit comments

Comments
 (0)