Skip to content

Commit

Permalink
Switch to streamlined Python3 super()
Browse files Browse the repository at this point in the history
  • Loading branch information
nightlark committed Feb 9, 2024
1 parent cf5c5ad commit e0bf095
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions helics/capi.py
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ def __delitem__(self, index):

class HelicsFilter(_HelicsCHandle):
def __init__(self, handle, cleanup=True):
super(HelicsFilter, self).__init__(handle, cleanup=cleanup)
super().__init__(handle, cleanup=cleanup)
self.option = _FilterOptionAccessor(self.handle, cleanup=False)

def __repr__(self):
Expand Down Expand Up @@ -1060,7 +1060,7 @@ class HelicsCloningFilter(HelicsFilter):

class HelicsTranslator(_HelicsCHandle):
def __init__(self, handle, cleanup=True):
super(HelicsTranslator, self).__init__(handle, cleanup=cleanup)
super().__init__(handle, cleanup=cleanup)


class HelicsCore(_HelicsCHandle):
Expand Down Expand Up @@ -1365,7 +1365,7 @@ def __delitem__(self, index):

class HelicsMessage(_HelicsCHandle):
def __init__(self, handle, cleanup=True):
super(HelicsMessage, self).__init__(handle, cleanup=cleanup)
super().__init__(handle, cleanup=cleanup)
self.flag = _MessageFlagAccessor(self.handle, cleanup=False)

def __repr__(self):
Expand Down Expand Up @@ -1608,8 +1608,7 @@ def __delitem__(self, index):

class HelicsFederateInfo(_HelicsCHandle):
def __init__(self, handle, cleanup=True):
# Python2 compatible super
super(HelicsFederateInfo, self).__init__(handle, cleanup)
super().__init__(handle, cleanup)

self.property = _FederateInfoPropertyAccessor(self.handle, cleanup=False)
self.flag = _FederateInfoFlagAccessor(self.handle, cleanup=False)
Expand Down Expand Up @@ -1825,8 +1824,7 @@ def __delitem__(self, index):

class HelicsFederate(_HelicsCHandle):
def __init__(self, handle, cleanup=True):
# Python2 compatible super
super(HelicsFederate, self).__init__(handle, cleanup)
super().__init__(handle, cleanup)

self._exec_async_iterate = False
self.property = _FederatePropertyAccessor(self.handle, cleanup=False)
Expand Down Expand Up @@ -2374,7 +2372,7 @@ def __delitem__(self, index):

class HelicsInput(_HelicsCHandle):
def __init__(self, handle):
super(HelicsInput, self).__init__(handle, cleanup=False)
super().__init__(handle, cleanup=False)
self.option = _InputOptionAccessor(self.handle, cleanup=False)

def __repr__(self):
Expand Down Expand Up @@ -2579,7 +2577,7 @@ def info(self, info: str):

class HelicsPublication(_HelicsCHandle):
def __init__(self, handle):
super(HelicsPublication, self).__init__(handle, cleanup=False)
super().__init__(handle, cleanup=False)
self.option = _PublicationOptionAccessor(self.handle, cleanup=False)

def __repr__(self):
Expand Down Expand Up @@ -2669,7 +2667,7 @@ def add_target(self, name: str):

class HelicsValueFederate(HelicsFederate):
def __init__(self, handle):
super(HelicsValueFederate, self).__init__(handle)
super().__init__(handle)

for i in range(0, self.n_publications):
pub = self.get_publication_by_index(i)
Expand Down Expand Up @@ -2858,7 +2856,7 @@ def publish_json(self, data: Union[dict, str]):

class HelicsMessageFederate(HelicsFederate):
def __init__(self, handle):
super(HelicsMessageFederate, self).__init__(handle)
super().__init__(handle)

for i in range(0, self.n_endpoints):
end = self.get_endpoint_by_index(i)
Expand Down

0 comments on commit e0bf095

Please sign in to comment.