@@ -5,60 +5,60 @@ class GetAction(ActionNode):
5
5
def __init__ (self ):
6
6
super ().__init__ (path = 'get' )
7
7
8
- def __call__ (self , target : Node ):
8
+ def __call__ (self , target : NodePath ):
9
9
return target .get ()
10
10
11
11
12
12
class SetAction (ActionNode ):
13
13
def __init__ (self ):
14
14
super ().__init__ (path = 'set' )
15
15
16
- def __call__ (self , target : Node , new_value ):
16
+ def __call__ (self , target : NodePath , new_value ):
17
17
target .set (new_value )
18
18
19
19
20
20
class ExistsAction (ActionNode ):
21
21
def __init__ (self ):
22
22
super ().__init__ (path = 'exists' )
23
23
24
- def __call__ (self , target : Node , node_name : str ) -> bool :
24
+ def __call__ (self , target : NodePath , node_name : str ) -> bool :
25
25
return target .contains (node_name )
26
26
27
27
28
28
class CreateAction (ActionNode ):
29
29
def __init__ (self ):
30
30
super ().__init__ (path = 'create' )
31
31
32
- def __call__ (self , target : Node , name : str , value = None ):
32
+ def __call__ (self , target : NodePath , name : str , value = None ):
33
33
target .append (Node (value ), name )
34
34
35
35
36
36
class RemoveAction (ActionNode ):
37
37
def __init__ (self ):
38
38
super ().__init__ (path = 'remove' )
39
39
40
- def __call__ (self , target : Node , node_name : str ):
40
+ def __call__ (self , target : NodePath , node_name : str ):
41
41
target .remove (node_name )
42
42
43
43
44
44
class ListAction (ActionNode ):
45
45
def __init__ (self ):
46
46
super ().__init__ (path = 'list' )
47
47
48
- def __call__ (self , target : Node ):
48
+ def __call__ (self , target : NodePath ):
49
49
# TODO: use link to list.nodes
50
50
return self .list_nodes (target )
51
51
52
52
@action (path = 'all' )
53
- def list_all (self , target : Node ):
53
+ def list_all (self , target : NodePath ):
54
54
return target .list ()
55
55
56
56
@action (path = 'nodes' )
57
- def list_nodes (self , target : Node ):
57
+ def list_nodes (self , target : NodePath ):
58
58
return [n for n in target .list () if not ListAction ._is_attribute (n )]
59
59
60
60
@action (path = 'attributes' )
61
- def list_attributes (self , target : Node ):
61
+ def list_attributes (self , target : NodePath ):
62
62
return [n for n in target .list () if ListAction ._is_attribute (n )]
63
63
64
64
@staticmethod
0 commit comments