From 66557edc120faac569004ba2bc426c5ac6a1100b Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Wed, 6 Mar 2019 02:10:20 +0100 Subject: Use a consistent style in examples Also remove some unused imports. --- examples/print_config_tree.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'examples/print_config_tree.py') diff --git a/examples/print_config_tree.py b/examples/print_config_tree.py index 8356dcb..90e529f 100644 --- a/examples/print_config_tree.py +++ b/examples/print_config_tree.py @@ -54,18 +54,19 @@ import sys from kconfiglib import Kconfig, \ - Symbol, Choice, MENU, COMMENT, \ + Symbol, MENU, COMMENT, \ BOOL, TRISTATE, STRING, INT, HEX, UNKNOWN, \ - expr_value, \ - TRI_TO_STR + expr_value # Add help description to output WITH_HELP_DESC = False + def indent_print(s, indent): print(" "*indent + s) + def value_str(sc): """ Returns the value part ("[*]", "", "(foo)" etc.) of a menu entry. @@ -99,6 +100,7 @@ def value_str(sc): return "{" + tri_val_str + "}" # Gets a bit confusing with .format() return "<{}>".format(tri_val_str) + def node_str(node): """ Returns the complete menu entry text for a menu node, or "" for invisible @@ -151,6 +153,7 @@ def node_str(node): return res + def print_menuconfig_nodes(node, indent): """ Prints a tree with all the menu entries rooted at 'node'. Child menu @@ -166,6 +169,7 @@ def print_menuconfig_nodes(node, indent): node = node.next + def print_menuconfig(kconf): """ Prints all menu entries for the configuration. @@ -177,6 +181,7 @@ def print_menuconfig(kconf): print_menuconfig_nodes(kconf.top_node.list, 0) print("") + if __name__ == "__main__": # Load Kconfig configuration files -- cgit v1.2.3