From 1bf133755e33e652d757f5c93960b7c6e46ca49b Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Mon, 2 Dec 2013 17:23:22 -0700 Subject: [PATCH] migen.fhdl.tools: move flat_iteration to migen.util.misc as tools imports other things --- migen/fhdl/module.py | 3 ++- migen/fhdl/tools.py | 11 +---------- migen/util/misc.py | 10 ++++++++++ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/migen/fhdl/module.py b/migen/fhdl/module.py index 4764abbc..30e065b6 100644 --- a/migen/fhdl/module.py +++ b/migen/fhdl/module.py @@ -4,7 +4,8 @@ from itertools import combinations from migen.fhdl.structure import * from migen.fhdl.structure import _Fragment from migen.fhdl.specials import Special -from migen.fhdl.tools import flat_iteration, rename_clock_domain +from migen.fhdl.tools import rename_clock_domain +from migen.util.misc import flat_iteration class FinalizeError(Exception): pass diff --git a/migen/fhdl/tools.py b/migen/fhdl/tools.py index d9407591..b25280ba 100644 --- a/migen/fhdl/tools.py +++ b/migen/fhdl/tools.py @@ -1,17 +1,8 @@ -import collections - from migen.fhdl.structure import * from migen.fhdl.structure import _Slice, _Assign from migen.fhdl.visit import NodeVisitor, NodeTransformer from migen.fhdl.size import value_bits_sign - -def flat_iteration(l): - for element in l: - if isinstance(element, collections.Iterable): - for element2 in flat_iteration(element): - yield element2 - else: - yield element +from migen.util.misc import flat_iteration class _SignalLister(NodeVisitor): def __init__(self): diff --git a/migen/util/misc.py b/migen/util/misc.py index fa041618..6846b4a5 100644 --- a/migen/util/misc.py +++ b/migen/util/misc.py @@ -1,3 +1,13 @@ +import collections + +def flat_iteration(l): + for element in l: + if isinstance(element, collections.Iterable): + for element2 in flat_iteration(element): + yield element2 + else: + yield element + def xdir(obj, return_values=False): for attr in dir(obj): if attr[:2] != "__" and attr[-2:] != "__": -- 2.30.2