MCPcopy Create free account
hub / github.com/OpenCCU/OpenCCU / node_iter

Method node_iter

buildroot-external/scripts/kconfiglib.py:1909–1958  ·  view source on GitHub ↗

Returns a generator for iterating through all MenuNode's in the Kconfig tree. The iteration is done in Kconfig definition order (each node is visited before its children, and the children of a node are visited before the next node). The Kconfig.top_node menu

(self, unique_syms=False)

Source from the content-addressed store, hash-verified

1907 ])
1908
1909 def node_iter(self, unique_syms=False):
1910 """
1911 Returns a generator for iterating through all MenuNode's in the Kconfig
1912 tree. The iteration is done in Kconfig definition order (each node is
1913 visited before its children, and the children of a node are visited
1914 before the next node).
1915
1916 The Kconfig.top_node menu node is skipped. It contains an implicit menu
1917 that holds the top-level items.
1918
1919 As an example, the following code will produce a list equal to
1920 Kconfig.defined_syms:
1921
1922 defined_syms = [node.item for node in kconf.node_iter()
1923 if isinstance(node.item, Symbol)]
1924
1925 unique_syms (default: False):
1926 If True, only the first MenuNode will be included for symbols defined
1927 in multiple locations.
1928
1929 Using kconf.node_iter(True) in the example above would give a list
1930 equal to unique_defined_syms.
1931 """
1932 if unique_syms:
1933 for sym in self.unique_defined_syms:
1934 sym._visited = False
1935
1936 node = self.top_node
1937 while 1:
1938 # Jump to the next node with an iterative tree walk
1939 if node.list:
1940 node = node.list
1941 elif node.next:
1942 node = node.next
1943 else:
1944 while node.parent:
1945 node = node.parent
1946 if node.next:
1947 node = node.next
1948 break
1949 else:
1950 # No more nodes
1951 return
1952
1953 if unique_syms and node.item.__class__ is Symbol:
1954 if node.item._visited:
1955 continue
1956 node.item._visited = True
1957
1958 yield node
1959
1960 def eval_string(self, s):
1961 """

Callers 1

_check_undef_symsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected