diff options
author | Josh Morman <jmorman@gnuradio.org> | 2021-11-24 12:48:20 -0500 |
---|---|---|
committer | mormj <34754695+mormj@users.noreply.github.com> | 2021-11-24 14:41:53 -0500 |
commit | 817fc3ce9cdc819a291e76ec324c4e748381f035 (patch) | |
tree | ed00faf5ea2c0f5a8caaba0ce41cd816dd6ca958 /grc/core/utils/expr_utils.py | |
parent | e776d673aa51b5ef19e16cfb6d22098c0b14a679 (diff) |
grc: pep8 formatting
Signed-off-by: Josh Morman <jmorman@gnuradio.org>
Diffstat (limited to 'grc/core/utils/expr_utils.py')
-rw-r--r-- | grc/core/utils/expr_utils.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/grc/core/utils/expr_utils.py b/grc/core/utils/expr_utils.py index bc669cc7c8..cfb1274049 100644 --- a/grc/core/utils/expr_utils.py +++ b/grc/core/utils/expr_utils.py @@ -7,6 +7,7 @@ SPDX-License-Identifier: GPL-2.0-or-later """ +import ast import string @@ -64,12 +65,10 @@ def sort_objects(objects, get_id, get_expr): return [id2obj[id] for id in sorted_ids] -import ast - - def dependencies(expr, names=None): node = ast.parse(expr, mode='eval') - used_ids = frozenset([n.id for n in ast.walk(node) if isinstance(n, ast.Name)]) + used_ids = frozenset( + [n.id for n in ast.walk(node) if isinstance(n, ast.Name)]) return used_ids & names if names else used_ids @@ -93,8 +92,6 @@ def sort_objects2(objects, id_getter, expr_getter, check_circular=True): return objects - - VAR_CHARS = string.ascii_letters + string.digits + '_' @@ -205,7 +202,8 @@ def _sort_variables(exprs): # Determine dependency order while var_graph.get_nodes(): # Get a list of nodes with no edges - indep_vars = [var for var in var_graph.get_nodes() if not var_graph.get_edges(var)] + indep_vars = [var for var in var_graph.get_nodes() + if not var_graph.get_edges(var)] if not indep_vars: raise Exception('circular dependency caught in sort_variables') # Add the indep vars to the end of the list |