Use super() instead of calling parent constructors directly
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Fri, 8 Jun 2012 16:06:12 +0000 (18:06 +0200)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Fri, 8 Jun 2012 16:06:12 +0000 (18:06 +0200)
migen/actorlib/control.py
migen/bank/description.py
migen/bus/csr.py
migen/bus/wishbone.py
migen/flow/actor.py
migen/flow/ala.py
migen/flow/network.py
migen/flow/plumbing.py

index 004d4f8e1d40439902af8ae6f7022baf7af5ee9e..9163bcf5f42904305120d957e9d4eb20b46a136f 100644 (file)
@@ -20,7 +20,7 @@ class For(Actor):
                        for n, bv in enumerate(self.d_bv)]
                l_source = [("d{0}".format(n), bv)
                        for n, bv in enumerate(self.d_bv)]
-               Actor.__init__(self,
+               super().__init__(
                        ("sink", Sink, l_sink),
                        ("source", Source, l_source))
        
index 01d59017d4884378c2f55f3b2548f0b2e8efa6ac..7f79ca6a8511e8a0b1497839f011ef3633e4d9c5 100644 (file)
@@ -38,7 +38,7 @@ class RegisterFields:
 class RegisterField(RegisterFields):
        def __init__(self, name, size=1, access_bus=READ_WRITE, access_dev=READ_ONLY, reset=0):
                self.field = Field(name, size, access_bus, access_dev, reset)
-               RegisterFields.__init__(self, name, [self.field])
+               super().__init__(name, [self.field])
 
 class FieldAlias:
        def __init__(self, f, start, end):
index 9fff20a2de64b05c0dc6c8ee784c3f4f3d393c66..af6064dac8af555bc2cb6a99ea6ae838fddc06df 100644 (file)
@@ -10,7 +10,7 @@ _desc = Description(
 
 class Interface(SimpleInterface):
        def __init__(self):
-               SimpleInterface.__init__(self, _desc)
+               super().__init__(_desc)
 
 class Interconnect(SimpleInterconnect):
        pass
index 5365b7954b0258054e0c7ce91c9f421a5ae5ec01..35a8f8a1c9af239e040067867641ce20d4aa0a02 100644 (file)
@@ -20,11 +20,11 @@ _desc = Description(
 
 class Interface(SimpleInterface):
        def __init__(self):
-               SimpleInterface.__init__(self, _desc)
+               super().__init__(_desc)
 
 class InterconnectPointToPoint(SimpleInterconnect):
        def __init__(self, master, slave):
-               SimpleInterconnect.__init__(self, master, [slave])
+               super().__init__(master, [slave])
 
 class Arbiter:
        def __init__(self, masters, target):
index 04793606f81c987b0fd3fdee60a0c26e4bc1bca8..7159c2a7fa4e0158edd45bc51b8994facc8a1c74 100644 (file)
@@ -93,7 +93,7 @@ class SequentialActor(BinaryActor):
        def __init__(self, delay, *endpoint_descriptions, **misc):
                self.delay = delay
                self.trigger = Signal()
-               BinaryActor.__init__(*endpoint_descriptions, **misc)
+               super().__init__(*endpoint_descriptions, **misc)
 
        def get_binary_control_fragment(self, stb_i, ack_o, stb_o, ack_i):
                ready = Signal()
@@ -125,7 +125,7 @@ class PipelinedActor(BinaryActor):
        def __init__(self, latency, *endpoint_descriptions, **misc):
                self.latency = latency
                self.pipe_ce = Signal()
-               BinaryActor.__init__(*endpoint_descriptions, **misc)
+               super().__init__(*endpoint_descriptions, **misc)
 
        def get_binary_control_fragment(self, stb_i, ack_o, stb_o, ack_i):
                valid = Signal(BV(self.latency))
index ca0da7e573c030db131fb9bb839859053db92be0..7e71c5245756ea945968945160e9a3c0d859df57 100644 (file)
@@ -7,7 +7,7 @@ from migen.corelogic import divider
 class _SimpleBinary(CombinatorialActor):
        def __init__(self, op, bv_op, bv_r):
                self.op = op
-               CombinatorialActor.__init__(self,
+               super().__init____(
                        ("operands", Sink, [("a", bv_op), ("b", bv_op)]),
                        ("result", Source, [("r", bv_r)]))
 
@@ -19,48 +19,48 @@ class _SimpleBinary(CombinatorialActor):
 
 class Add(_SimpleBinary):
        def __init__(self, bv):
-               _SimpleBinary.__init__(self, "+", bv, BV(bv.width+1, bv.signed))
+               super().__init__("+", bv, BV(bv.width+1, bv.signed))
 
 class Sub(_SimpleBinary):
        def __init__(self, bv):
-               _SimpleBinary.__init__(self, "-", bv, BV(bv.width+1, bv.signed))
+               super().__init__("-", bv, BV(bv.width+1, bv.signed))
 
 class Mul(_SimpleBinary):
        def __init__(self, bv):
-               _SimpleBinary.__init__(self, "*", bv, BV(2*bv.width, bv.signed))
+               super().__init__("*", bv, BV(2*bv.width, bv.signed))
 
 class And(_SimpleBinary):
        def __init__(self, bv):
-               _SimpleBinary.__init__(self, "&", bv, bv)
+               super().__init__("&", bv, bv)
 
 class Xor(_SimpleBinary):
        def __init__(self, bv):
-               _SimpleBinary.__init__(self, "^", bv, bv)
+               super().__init__("^", bv, bv)
 
 class Or(_SimpleBinary):
        def __init__(self, bv):
-               _SimpleBinary.__init__(self, "|", bv, bv)
+               super().__init__("|", bv, bv)
 
 class LT(_SimpleBinary):
        def __init__(self, bv):
-               _SimpleBinary.__init__(self, "<", bv, BV(1))
+               super().__init__("<", bv, BV(1))
 
 class LE(_SimpleBinary):
        def __init__(self, bv):
-               _SimpleBinary.__init__(self, "<=", bv, BV(1))
+               super().__init__("<=", bv, BV(1))
 
 class EQ(_SimpleBinary):
        def __init__(self, bv):
-               _SimpleBinary.__init__(self, "==", bv, BV(1))
+               super().__init__("==", bv, BV(1))
 
 class NE(_SimpleBinary):
        def __init__(self, bv):
-               _SimpleBinary.__init__(self, "!=", bv, BV(1))
+               super().__init__("!=", bv, BV(1))
 
 class DivMod(SequentialActor):
        def __init__(self, width):
                self.div = divider.Divider(width)
-               SequentialActor.__init__(self, width,
+               super().__init__(width,
                        ("operands", Sink, [("dividend", self.div.dividend_i), ("divisor", self.div.divisor_i)]),
                        ("result", Source, [("quotient", self.div.quotient_o), ("remainder", self.div.remainder_o)]))
 
index fc9c7214a2aafe383a30234f4361b0464505e816..5eb98ac7fd4ac19899d15adbfa6f10972415cdce 100644 (file)
@@ -7,7 +7,7 @@ from migen.corelogic.misc import optree
 class CompositeActor(Actor):
        def __init__(self, dfg): # TODO: endpoints
                self.dfg = dfg
-               Actor.__init__(self)
+               super().__init__()
        
        def get_fragment(self):
                this_fragments = [get_conn_fragment(x[0].endpoints[x[2]["source"]], x[1].endpoints[x[2]["sink"]])
index 25921f189c4096d89de1a50e50d13ff068227506..017f037df2f08162b978aa0631cf7f70a53ca06e 100644 (file)
@@ -5,7 +5,7 @@ from migen.corelogic.misc import optree
 
 class Buffer(PipelinedActor):
        def __init__(self, layout):
-               PipelinedActor.__init__(self, 1,
+               super().__init__(1,
                        ("d", Sink, layout), ("q", Source, layout))
        
        def get_process_fragment(self):
@@ -22,7 +22,7 @@ class Combinator(CombinatorialActor):
                        for n, r in enumerate(subrecords)]
                ep_source = ("source", Source, source)
                eps.append(ep_source)
-               CombinatorialActor.__init__(self, *eps)
+               super().__init__(*eps)
 
        def get_fragment(self):
                source = self.endpoints["source"]
@@ -40,6 +40,6 @@ class Splitter(CombinatorialActor):
                        for n, r in enumerate(subrecords)]
                ep_sink = ("sink", Sink, sink)
                eps.append(ep_sink)
-               CombinatorialActor.__init__(self, *eps)
+               super().__init__(*eps)
                
        # TODO def get_fragment(self):