summaryrefslogtreecommitdiff
path: root/src/buildstream/node.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildstream/node.pyx')
-rw-r--r--src/buildstream/node.pyx42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/buildstream/node.pyx b/src/buildstream/node.pyx
index 89bb18eaf..bf6ce3a32 100644
--- a/src/buildstream/node.pyx
+++ b/src/buildstream/node.pyx
@@ -97,6 +97,14 @@ cdef class Node:
"""
raise NotImplementedError()
+ cpdef object strip_node_info(self):
+ """ Remove all the node information (provenance) and return the underlying data as plain python objects
+
+ Returns:
+ (list, dict, str, None): the underlying data that was held in the node structure.
+ """
+ raise NotImplementedError()
+
#############################################################
# Public Methods #
#############################################################
@@ -176,14 +184,6 @@ cdef class Node:
cpdef void _assert_fully_composited(self) except *:
raise NotImplementedError()
- # _strip_node_info()
- #
- # Remove all the node information (provenance) and return
- # the underlying data as plain python objects (list, dict, str, None)
- #
- cpdef object _strip_node_info(self):
- raise NotImplementedError()
-
#############################################################
# Abstract Protected Methods #
#############################################################
@@ -414,6 +414,9 @@ cdef class ScalarNode(Node):
cpdef ScalarNode clone(self):
return self
+ cpdef object strip_node_info(self):
+ return self.value
+
#############################################################
# Private Methods implementations #
#############################################################
@@ -421,9 +424,6 @@ cdef class ScalarNode(Node):
cpdef void _assert_fully_composited(self) except *:
pass
- cpdef object _strip_node_info(self):
- return self.value
-
#############################################################
# Protected Methods #
#############################################################
@@ -870,6 +870,12 @@ cdef class MappingNode(Node):
return MappingNode.__new__(MappingNode, self.file_index, self.line, self.column, copy)
+ cpdef object strip_node_info(self):
+ cdef str key
+ cdef Node value
+
+ return {key: value.strip_node_info() for key, value in self.value.items()}
+
#############################################################
# Private Methods used in BuildStream #
#############################################################
@@ -949,12 +955,6 @@ cdef class MappingNode(Node):
value._assert_fully_composited()
- cpdef object _strip_node_info(self):
- cdef str key
- cdef Node value
-
- return {key: value._strip_node_info() for key, value in self.value.items()}
-
#############################################################
# Protected Methods #
#############################################################
@@ -1371,6 +1371,10 @@ cdef class SequenceNode(Node):
return SequenceNode.__new__(SequenceNode, self.file_index, self.line, self.column, copy)
+ cpdef object strip_node_info(self):
+ cdef Node value
+ return [value.strip_node_info() for value in self.value]
+
#############################################################
# Private Methods implementations #
#############################################################
@@ -1380,10 +1384,6 @@ cdef class SequenceNode(Node):
for value in self.value:
value._assert_fully_composited()
- cpdef object _strip_node_info(self):
- cdef Node value
- return [value._strip_node_info() for value in self.value]
-
#############################################################
# Protected Methods #
#############################################################