|
9 | 9 | "__package__", |
10 | 10 | "__spec__", |
11 | 11 | "special variables", |
12 | | -] |
| 12 | +] # Dont display these |
13 | 13 | VARIABLE_TYPES_TO_FILTER = [ |
14 | 14 | "builtin_function_or_method", |
15 | 15 | "method-wrapper", |
@@ -99,21 +99,25 @@ def render_variable_tree(variables): |
99 | 99 | evaluate_name = v.get("evaluateName", "") |
100 | 100 | children = v.get("children", []) |
101 | 101 |
|
| 102 | + # Filter out certain variable names |
| 103 | + if name in VARIABLE_NAMES_TO_FILTER: |
| 104 | + continue |
| 105 | + # Filter out certain variable types |
| 106 | + if var_type in VARIABLE_TYPES_TO_FILTER: |
| 107 | + continue |
| 108 | + |
102 | 109 | # Render one node for the variable |
103 | 110 | with hd.scope(v): |
104 | | - # Filter out certain variable names |
105 | | - if name in VARIABLE_NAMES_TO_FILTER: |
106 | | - continue |
107 | | - # Filter out certain variable types |
108 | | - if var_type in VARIABLE_TYPES_TO_FILTER: |
109 | | - continue |
110 | 111 | print(f"Rendering variable: {name} with value: {value}") |
111 | 112 | with hd.tree_item(): |
112 | | - hd.markdown(f"**{name}**") |
113 | | - hd.markdown(f"`{value}`") |
114 | | - hd.markdown(f"`{var_type}`") |
115 | | - hd.markdown(f"`{evaluate_name}`") |
116 | | - hd.markdown(f"`{v.get('variablesReference', 0)}`") |
| 113 | + # hd.markdown(f"**{name}**") |
| 114 | + # hd.markdown(f"{name}") |
| 115 | + # hd.markdown(f"`{value}`") |
| 116 | + # hd.markdown(f"`{var_type}`") |
| 117 | + # hd.markdown(f"`{evaluate_name}`") |
| 118 | + # hd.markdown(f"`{v.get('variablesReference', 0)}`") |
| 119 | + |
| 120 | + hd.markdown(f"**{name}**: `{value}` (**Type**: {var_type})") |
117 | 121 |
|
118 | 122 | # If this variable has child variables, recurse |
119 | 123 | if children: |
@@ -155,9 +159,22 @@ def pov(): |
155 | 159 | # render_table(locals_scope, "Locals") |
156 | 160 |
|
157 | 161 | # Tree method |
158 | | - render_tree(globals_scope, "Globals") |
| 162 | + # render_tree(globals_scope, "Globals") |
159 | 163 | # hd.divider(spacing=2) |
160 | | - # render_tree(locals_scope, "Locals") |
| 164 | + render_tree(locals_scope, "Locals") |
| 165 | + |
| 166 | + # with hd.tree(indent_guide_width="1px"): |
| 167 | + # hd.tree_item("One") |
| 168 | + # hd.tree_item("Two") |
| 169 | + # with hd.tree_item("Three"): |
| 170 | + # hd.tree_item("Three A") |
| 171 | + # hd.tree_item("Three B") |
| 172 | + # with hd.tree_item("Three C"): |
| 173 | + # hd.tree_item("Three C-1") |
| 174 | + # hd.tree_item("Three C-2") |
| 175 | + # hd.tree_item("Three D") |
| 176 | + # hd.tree_item("Four") |
| 177 | + # hd.tree_item("Five") |
161 | 178 |
|
162 | 179 |
|
163 | 180 | hd.run( |
|
0 commit comments