Skip to content

Commit

Permalink
Call super to call methods from the parent class
Browse files Browse the repository at this point in the history
Not only does it make it clearer to the reader what the intent is behind
the code, it fixes MRO evaluation of classes if the parent-child
relationship is nonlinear.

Signed-off-by: Enji Cooper <[email protected]>
  • Loading branch information
ngie-eign committed Mar 27, 2020
1 parent 8317594 commit cfcc093
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions event_rpcgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ def CodeBase(self):
class EntryBytes(Entry):
def __init__(self, type, name, tag, length):
# Init base class
Entry.__init__(self, type, name, tag)
super(EntryBytes, self).__init__(type, name, tag)

self._length = length
self._ctype = "ev_uint8_t"
Expand Down Expand Up @@ -687,13 +687,13 @@ def Verify(self):
"around line %d" % (self._name, self.LineCount())
)

Entry.Verify(self)
super(EntryBytes, self).Verify()


class EntryInt(Entry):
def __init__(self, type, name, tag, bits=32):
# Init base class
Entry.__init__(self, type, name, tag)
super(EntryInt, self).__init__(type, name, tag)

self._can_be_array = True
if bits == 32:
Expand Down Expand Up @@ -752,7 +752,7 @@ def CodeInitialize(self, name):
class EntryString(Entry):
def __init__(self, type, name, tag):
# Init base class
Entry.__init__(self, type, name, tag)
super(EntryString, self).__init__(type, name, tag)

self._can_be_array = True
self._ctype = "char *"
Expand Down Expand Up @@ -870,7 +870,7 @@ def Declaration(self):
class EntryStruct(Entry):
def __init__(self, type, name, tag, refname):
# Init base class
Entry.__init__(self, type, name, tag)
super(EntryStruct, self).__init__(type, name, tag)

self._optpointer = False
self._can_be_array = True
Expand Down Expand Up @@ -1049,7 +1049,7 @@ def Declaration(self):
class EntryVarBytes(Entry):
def __init__(self, type, name, tag):
# Init base class
Entry.__init__(self, type, name, tag)
super(EntryVarBytes, self).__init__(type, name, tag)

self._ctype = "ev_uint8_t *"

Expand Down Expand Up @@ -1180,7 +1180,7 @@ def Declaration(self):
class EntryArray(Entry):
def __init__(self, entry):
# Init base class
Entry.__init__(self, entry._type, entry._name, entry._tag)
super(EntryArray, self).__init__(entry._type, entry._name, entry._tag)

self._entry = entry
self._refname = entry._refname
Expand Down

0 comments on commit cfcc093

Please sign in to comment.