Skip to content

Commit

Permalink
CLN : Update super usage (#300)
Browse files Browse the repository at this point in the history
done using automated regex-based search and replace
  • Loading branch information
Poruri Sai Rahul authored Aug 26, 2020
1 parent 1eccd80 commit 8eddfc4
Show file tree
Hide file tree
Showing 31 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion envisage/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def __init__(self, plugins=None, **traits):
"""

super(Application, self).__init__(**traits)
super().__init__(**traits)

# fixme: We have to initialize the application home here (i.e. we can't
# wait until the 'home' trait is accessed) because the scoped
Expand Down
2 changes: 1 addition & 1 deletion envisage/extension_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def __init__(self, trait_type=List, id=None, **metadata):
# point traits easier to find with the 'traits' and 'trait_names'
# methods on 'HasTraits'.
metadata["__extension_point__"] = True
super(ExtensionPoint, self).__init__(**metadata)
super().__init__(**metadata)

# The trait type that describes the extension point.
#
Expand Down
2 changes: 1 addition & 1 deletion envisage/extension_point_binding.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ExtensionPointBinding(HasTraits):
def __init__(self, **traits):
""" Constructor. """

super(ExtensionPointBinding, self).__init__(**traits)
super().__init__(**traits)

# Initialize the object's trait from the extension point.
self._set_trait(notify=False)
Expand Down
2 changes: 1 addition & 1 deletion envisage/extension_point_changed_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, extension_point_id=None, **kw):
""" Constructor. """

# The base class has the 'index', 'removed' and 'added' attributes.
super(ExtensionPointChangedEvent, self).__init__(**kw)
super().__init__(**kw)

# We add the extension point Id.
self.extension_point_id = extension_point_id
Expand Down
4 changes: 2 additions & 2 deletions envisage/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def start(self):
""" Start the plugin.
This method will *always* be empty so that you never have to call
'super(xxx, self).start()' if you provide an implementation in a
'super().start()' if you provide an implementation in a
derived class.
The framework does what it needs to do when it starts a plugin by means
Expand All @@ -220,7 +220,7 @@ def stop(self):
""" Stop the plugin.
This method will *always* be empty so that you never have to call
'super(xxx, self).stop()' if you provide an implementation in a
'super().stop()' if you provide an implementation in a
derived class.
The framework does what it needs to do when it stops a plugin by means
Expand Down
2 changes: 1 addition & 1 deletion envisage/plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __init__(self, plugins=None, **traits):
"""

super(PluginManager, self).__init__(**traits)
super().__init__(**traits)

if plugins is not None:
self._plugins = plugins
Expand Down
2 changes: 1 addition & 1 deletion envisage/plugins/ipython_kernel/heartbeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Heartbeat(ipykernel.heartbeat.Heartbeat):

def run(self):
try:
super(Heartbeat, self).run()
super().run()
except zmq.ZMQError as e:
# We expect to get here on normal context termination, but
# not otherwise; re-raise if the error is not the expected one
Expand Down
6 changes: 3 additions & 3 deletions envisage/plugins/ipython_kernel/kernelapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def init_crash_handler(self):
can be restored later.
"""
self._original_sys_excepthook = sys.excepthook
super(IPKernelApp, self).init_crash_handler()
super().init_crash_handler()

def init_io(self):
"""
Expand All @@ -155,7 +155,7 @@ def init_io(self):
if self.displayhook_class:
self._original_sys_displayhook = sys.displayhook

super(IPKernelApp, self).init_io()
super().init_io()

def init_kernel(self):
"""
Expand All @@ -170,7 +170,7 @@ def init_kernel(self):
self._original_ipython_utils_io_stderr = getattr(
IPython.utils.io, "stderr", _MISSING
)
super(IPKernelApp, self).init_kernel()
super().init_kernel()

# New methods, mostly to control shutdown #################################

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def test_service_not_used(self):

class TrackingInternalIPKernel(internal_ipkernel.InternalIPKernel):
def __init__(self, *args, **kwargs):
super(TrackingInternalIPKernel, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
kernel_instances.append(self)

patcher = mock.patch.object(
Expand All @@ -142,7 +142,7 @@ def test_service_used(self):

class TrackingInternalIPKernel(internal_ipkernel.InternalIPKernel):
def __init__(self, *args, **kwargs):
super(TrackingInternalIPKernel, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
kernel_instances.append(self)

patcher = mock.patch.object(
Expand Down
2 changes: 1 addition & 1 deletion envisage/plugins/python_shell/view/python_shell_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def destroy_control(self):
"""

super(PythonShellView, self).destroy_control()
super().destroy_control()

# Unregister the view as a service.
self.window.application.unregister_service(self._service_id)
Expand Down
2 changes: 1 addition & 1 deletion envisage/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(
):
""" Constructor. """

super(Service, self).__init__(**metadata)
super().__init__(**metadata)

# The protocol that the service must provide.
self._protocol = protocol
Expand Down
4 changes: 2 additions & 2 deletions envisage/ui/action/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CGroup(Instance):
def __init__(self, **kw):
""" Constructor. """

super(CGroup, self).__init__(klass=Group, **kw)
super().__init__(klass=Group, **kw)

return

Expand All @@ -46,7 +46,7 @@ def validate(self, object, name, value):
if isinstance(value, str):
value = Group(id=value)

return super(CGroup, self).validate(object, name, value)
return super().validate(object, name, value)


class Menu(Location):
Expand Down
4 changes: 2 additions & 2 deletions envisage/ui/action/tool_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CGroup(Instance):
def __init__(self, **kw):
""" Constructor. """

super(CGroup, self).__init__(klass=Group, **kw)
super().__init__(klass=Group, **kw)

return

Expand All @@ -47,7 +47,7 @@ def validate(self, object, name, value):
if isinstance(value, str):
value = Group(id=value)

return super(CGroup, self).validate(object, name, value)
return super().validate(object, name, value)


class ToolBar(Location):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def _on_project_changed(self, obj, trait_name, old, new):
if new is not None:
self._update_project_listeners(new, remove=False)

super(SaveAsAction, self)._on_project_changed(
super()._on_project_changed(
obj, trait_name, old, new
)

Expand Down
2 changes: 1 addition & 1 deletion envisage/ui/single_project/action/save_project_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def _on_project_changed(self, obj, trait_name, old, new):
if new is not None:
self._update_project_listeners(new, remove=False)

super(SaveAction, self)._on_project_changed(obj, trait_name, old, new)
super()._on_project_changed(obj, trait_name, old, new)

##########################################################################
# 'SaveAction' interface
Expand Down
4 changes: 2 additions & 2 deletions envisage/ui/single_project/editor/project_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self, **traits):
"""

super(ProjectEditor, self).__init__(**traits)
super().__init__(**traits)

# Make sure the current project knows this editor is associated with
# it's resources
Expand Down Expand Up @@ -88,6 +88,6 @@ def destroy_control(self):
# Unregister from the associated project immediately.
self.project.register_editor(self.resource, self, remove=True)

super(ProjectEditor, self).destroy_control()
super().destroy_control()

return
2 changes: 1 addition & 1 deletion envisage/ui/single_project/model_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(self, application, factory, **traits):
"""

super(ModelService, self).__init__(
super().__init__(
application=application, factory=factory, **traits
)

Expand Down
6 changes: 3 additions & 3 deletions envisage/ui/single_project/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def __getstate__(self):
"""

# Determine the starting point for our state.
state = super(Project, self).__getstate__().copy()
state = super().__getstate__().copy()

# Remove any transient traits.
for trait_name in self.trait_names(transient=True):
Expand Down Expand Up @@ -187,15 +187,15 @@ def __setstate__(self, state):
state.pop(key, None)

# Restore our state.
return super(Project, self).__setstate__(state)
return super().__setstate__(state)

def __str__(self):
"""
Return the unofficial string representation of this object.
"""

result = "%s(name=%s)" % (super(Project, self).__str__(), self.name)
result = "%s(name=%s)" % (super().__str__(), self.name)
return result

##########################################################################
Expand Down
2 changes: 1 addition & 1 deletion envisage/ui/single_project/project_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __init__(self, *args, **kws):
self._update_model_service_listeners(remove=False)
"""

super(ProjectAction, self).__init__(*args, **kws)
super().__init__(*args, **kws)

return

Expand Down
2 changes: 1 addition & 1 deletion envisage/ui/single_project/project_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def start(self):
"""

super(ProjectPlugin, self).start()
super().start()

# FIXME: We eventually won't have to explicitly register the
# services ourselves, since we contribute them as service offers
Expand Down
2 changes: 1 addition & 1 deletion envisage/ui/single_project/ui_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def __init__(self, model_service, menu_manager, **traits):
"""

super(UiService, self).__init__(
super().__init__(
model_service=model_service,
default_context_menu_manager=menu_manager,
**traits,
Expand Down
2 changes: 1 addition & 1 deletion envisage/ui/single_project/view/project_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class ProjectView(HasTraits):
# 'View' interface.
##########################################################################
def __init__(self, **traits):
super(ProjectView, self).__init__(**traits)
super().__init__(**traits)

# Make sure our view stays in sync with the current project
model_service = self._get_model_service()
Expand Down
2 changes: 1 addition & 1 deletion envisage/ui/tasks/action/preferences_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ class PreferencesGroup(Group):
###########################################################################

def __init__(self, **traits):
super(PreferencesGroup, self).__init__(PreferencesAction(), **traits)
super().__init__(PreferencesAction(), **traits)
2 changes: 1 addition & 1 deletion envisage/ui/tasks/action/task_window_toggle_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class TaskWindowToggleGroup(Group):
def destroy(self):
""" Called when the group is no longer required.
"""
super(TaskWindowToggleGroup, self).destroy()
super().destroy()
if self.application:
self.application.on_trait_change(
self._rebuild, "window_opened, window_closed", remove=True
Expand Down
2 changes: 1 addition & 1 deletion envisage/ui/tasks/preferences_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def close(self, info, is_ok):
"""
if is_ok:
self.apply()
return super(PreferencesDialog, self).close(info, is_ok)
return super().close(info, is_ok)

###########################################################################
# Protected interface.
Expand Down
2 changes: 1 addition & 1 deletion envisage/ui/tasks/preferences_pane.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ def close(self, info, is_ok):
"""
if is_ok:
self.apply()
return super(PreferencesPane, self).close(info, is_ok)
return super().close(info, is_ok)
6 changes: 3 additions & 3 deletions examples/plugins/single_project/sample_project/data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class Data(NumericContext):
""" Contains all of the data for a data """

def __init__(self, name="Unknown", **traits):
super(Data, self).__init__(**traits)
super().__init__(**traits)
self.context_name = name
self.data_parameters = DataView()
# self.data_parameters = DataView()
Expand All @@ -109,7 +109,7 @@ def __getstate__(self):
"""

# Obtain state from base class(es)
state = super(Data, self).__getstate__()
state = super().__getstate__()

# Add in our current version number. Note use a different attribute
# name from any base or derived class so that our numbers don't
Expand Down Expand Up @@ -145,7 +145,7 @@ def __setstate__(self, state):
)

# Restore the base class's state.
super(Data, self).__setstate__(state)
super().__setstate__(state)

return

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(self, **kws):
"""

super(DataPluginAction, self).__init__(**kws)
super().__init__(**kws)

if self.data_model_service is None:
self.data_model_service = "service://%s" % IDATA_MODEL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self, **kws):
"""

super(UiService, self).__init__(**kws)
super().__init__(**kws)

# Ensure we have a default model-service if one wasn't specified.
if self.model_service is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def __getstate__(self):
"""

# Obtain state from base class(es)
state = super(EnvProject, self).__getstate__()
state = super().__getstate__()

# Add in our current version number. Note use a different attribute
# name from any base or derived class so that our numbers don't
Expand Down Expand Up @@ -127,7 +127,7 @@ def __setstate__(self, state):
)

# Restore the base class's state.
super(EnvProject, self).__setstate__(state)
super().__setstate__(state)

return

Expand Down
4 changes: 2 additions & 2 deletions examples/plugins/tasks/ipython_kernel/python_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class PythonEditorEventFilter(QtCore.QObject):
"""

def __init__(self, editor, parent):
super(PythonEditorEventFilter, self).__init__(parent)
super().__init__(parent)
self.__editor = editor

def eventFilter(self, obj, event):
Expand Down Expand Up @@ -190,4 +190,4 @@ def eventFilter(self, obj, event):
event=event,
)

return super(PythonEditorEventFilter, self).eventFilter(obj, event)
return super().eventFilter(obj, event)

0 comments on commit 8eddfc4

Please sign in to comment.