migen.fhdl.tools: move flat_iteration to migen.util.misc as tools imports other things

This commit is contained in:
Robert Jordens 2013-12-02 17:23:22 -07:00 committed by Sebastien Bourdeauducq
parent fe67210d77
commit 1bf133755e
3 changed files with 13 additions and 11 deletions

View file

@ -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

View file

@ -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):

View file

@ -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:] != "__":