Commit 3a90da8d authored by Claude Paroz's avatar Claude Paroz

Calling super() whenever possible

parent f5363fed
......@@ -65,7 +65,7 @@ class MeldDistribution(distutils.dist.Distribution):
def __init__(self, *args, **kwargs):
self.no_update_icon_cache = False
self.no_compile_schemas = False
distutils.dist.Distribution.__init__(self, *args, **kwargs)
super().__init__(*args, **kwargs)
class build_data(distutils.cmd.Command):
......
......@@ -22,7 +22,7 @@ class DiffGrid(Gtk.Grid):
__gtype_name__ = "DiffGrid"
def __init__(self):
Gtk.Grid.__init__(self)
super().__init__()
self._in_drag = False
self._drag_pos = -1
self._drag_handle = None
......
......@@ -29,7 +29,7 @@ class DiffMap(Gtk.DrawingArea):
__gtype_name__ = "DiffMap"
def __init__(self):
Gtk.DrawingArea.__init__(self)
super().__init__()
self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
self._last_allocation = None
self._scrolladj = None
......
......@@ -206,8 +206,7 @@ COL_EMBLEM, COL_EMBLEM_SECONDARY, COL_SIZE, COL_TIME, COL_PERMS, COL_END = \
class DirDiffTreeStore(tree.DiffTreeStore):
def __init__(self, ntree):
tree.DiffTreeStore.__init__(
self, ntree, [str, str, object, object, object])
super().__init__(ntree, [str, str, object, object, object])
class CanonicalListing:
......
......@@ -25,12 +25,12 @@ class FileMerge(FileDiff):
differ = merge.AutoMergeDiffer
def _connect_buffer_handlers(self):
FileDiff._connect_buffer_handlers(self)
super()._connect_buffer_handlers()
self.textview[0].set_editable(0)
self.textview[2].set_editable(0)
def get_comparison(self):
comp = FileDiff.get_comparison(self)
comp = super().get_comparison()
return RecentType.Merge, comp[1]
def _merge_files(self):
......
......@@ -78,7 +78,7 @@ class Differ(GObject.GObject):
def __init__(self):
# Internally, diffs are stored from text1 -> text0 and text1 -> text2.
GObject.GObject.__init__(self)
super().__init__()
self.num_sequences = 0
self.seqlength = [0, 0, 0]
self.diffs = [[], []]
......
......@@ -23,12 +23,12 @@ class AutoMergeDiffer(diffutil.Differ):
# _matcher = PatienceSequenceMatcher
def __init__(self):
diffutil.Differ.__init__(self)
super().__init__()
self.auto_merge = False
self.unresolved = []
def _auto_merge(self, using, texts):
for out0, out1 in diffutil.Differ._auto_merge(self, using, texts):
for out0, out1 in super()._auto_merge(using, texts):
if self.auto_merge and out0[0] == 'conflict':
# we will try to resolve more complex conflicts automatically
# here... if possible
......@@ -195,8 +195,7 @@ class AutoMergeDiffer(diffutil.Differ):
]
self.unresolved[lo:hi] = []
return diffutil.Differ.change_sequence(
self, sequence, startidx, sizechange, texts)
return super().change_sequence(sequence, startidx, sizechange, texts)
def get_unresolved_count(self):
return len(self.unresolved)
......
......@@ -83,7 +83,7 @@ class MyersSequenceMatcher(difflib.SequenceMatcher):
return self.matching_blocks
def get_opcodes(self):
opcodes = difflib.SequenceMatcher.get_opcodes(self)
opcodes = super().get_opcodes()
return [DiffChunk._make(chunk) for chunk in opcodes]
def get_difference_opcodes(self):
......@@ -349,13 +349,13 @@ class InlineMyersSequenceMatcher(MyersSequenceMatcher):
class SyncPointMyersSequenceMatcher(MyersSequenceMatcher):
def __init__(self, isjunk=None, a="", b="", syncpoints=None):
MyersSequenceMatcher.__init__(self, isjunk, a, b)
super().__init__(isjunk, a, b)
self.isjunk = isjunk
self.syncpoints = syncpoints
def initialise(self):
if self.syncpoints is None or len(self.syncpoints) == 0:
for i in MyersSequenceMatcher.initialise(self):
for i in super().initialise():
yield i
else:
chunks = []
......
......@@ -43,7 +43,7 @@ optparse._ = _
class MeldApp(Gtk.Application):
def __init__(self):
Gtk.Application.__init__(self)
super().__init__()
self.set_flags(Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
self.set_application_id("org.gnome.meld")
GLib.set_application_name("Meld")
......@@ -200,7 +200,7 @@ class MeldApp(Gtk.Application):
self.should_exit = False
self.output = io.StringIO()
self.exit_status = 0
optparse.OptionParser.__init__(self, *args, **kwargs)
super().__init__(*args, **kwargs)
def exit(self, status=0, msg=None):
self.should_exit = True
......
......@@ -37,7 +37,7 @@ class MeldBuffer(GtkSource.Buffer):
)
def __init__(self):
GtkSource.Buffer.__init__(self)
super().__init__()
bind_settings(self)
self.data = MeldBufferData()
self.undo_sequence = None
......@@ -98,7 +98,7 @@ class MeldBufferData(GObject.GObject):
)
def __init__(self):
GObject.GObject.__init__(self)
super().__init__()
self._gfile = None
self._label = None
self._monitor = None
......
......@@ -93,7 +93,7 @@ class MeldDoc(LabeledObjectMixin, GObject.GObject):
}
def __init__(self):
GObject.GObject.__init__(self)
super().__init__()
self.scheduler = FifoScheduler()
self.num_panes = 0
self.main_actiongroup = None
......
......@@ -40,7 +40,7 @@ from meld.windowstate import SavedWindowState
class MeldWindow(Component):
def __init__(self):
Component.__init__(self, "meldapp.ui", "meldapp")
super().__init__("meldapp.ui", "meldapp")
self.widget.set_name("meldapp")
actions = (
......
......@@ -31,8 +31,8 @@ class FilterList(ListWidget):
def __init__(self, key, filter_type):
default_entry = [_("label"), False, _("pattern"), True]
ListWidget.__init__(
self, "EditableList.ui", "list_vbox", ["EditableListStore"],
super().__init__(
"EditableList.ui", "list_vbox", ["EditableListStore"],
"EditableList", default_entry)
self.key = key
self.filter_type = filter_type
......@@ -85,8 +85,8 @@ class ColumnList(ListWidget):
}
def __init__(self, key):
ListWidget.__init__(
self, "EditableList.ui", "columns_ta", ["ColumnsListStore"],
super().__init__(
"EditableList.ui", "columns_ta", ["ColumnsListStore"],
"columns_treeview")
self.key = key
......@@ -124,7 +124,7 @@ class ColumnList(ListWidget):
class GSettingsComboBox(Gtk.ComboBox):
def __init__(self):
Gtk.ComboBox.__init__(self)
super().__init__()
self.connect('notify::gsettings-value', self._setting_changed)
self.connect('notify::active', self._active_changed)
......@@ -182,8 +182,8 @@ class GSettingsStringComboBox(GSettingsComboBox):
class PreferencesDialog(Component):
def __init__(self, parent):
Component.__init__(
self, "preferences.ui", "preferencesdialog", [
super().__init__(
"preferences.ui", "preferencesdialog", [
"adjustment1", "adjustment2", "fileorderstore",
"sizegroup_editor", "timestampstore", "mergeorderstore",
"sizegroup_file_order_labels", "sizegroup_file_order_combos",
......
......@@ -35,7 +35,7 @@ class MeldSettings(GObject.GObject):
}
def __init__(self):
GObject.GObject.__init__(self)
super().__init__()
self.on_setting_changed(settings, 'filename-filters')
self.on_setting_changed(settings, 'text-filters')
self.on_setting_changed(settings, 'use-system-font')
......
......@@ -18,7 +18,6 @@ import os
from gi.repository import Gdk
from gi.repository import GLib
from gi.repository import Gtk
from gi.repository import Pango
from meld.misc import colour_lookup_with_fallback
......@@ -43,7 +42,7 @@ class DiffTreeStore(SearchableTreeStore):
full_types = []
for col_type in (COL_TYPES + tuple(types)):
full_types.extend([col_type] * ntree)
Gtk.TreeStore.__init__(self, *full_types)
super().__init__(*full_types)
self.ntree = ntree
self._setup_default_styles()
......
......@@ -34,8 +34,8 @@ class MeldFileChooserDialog(Gtk.FileChooserDialog):
def __init__(
self, title=None, transient_for=None,
action=Gtk.FileChooserAction.OPEN):
Gtk.FileChooserDialog.__init__(
self, title=title, transient_for=transient_for, action=action)
super().__init__(
title=title, transient_for=transient_for, action=action)
self.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
if action == Gtk.FileChooserAction.SAVE:
......
......@@ -21,8 +21,8 @@ from meld.ui import gnomeglade
class FindBar(gnomeglade.Component):
def __init__(self, parent):
gnomeglade.Component.__init__(self, "findbar.ui", "findbar",
["arrow_left", "arrow_right"])
super().__init__("findbar.ui", "findbar",
["arrow_left", "arrow_right"])
self.set_text_view(None)
self.arrow_left.show()
self.arrow_right.show()
......
......@@ -20,8 +20,7 @@ from . import gnomeglade
class ListWidget(gnomeglade.Component):
def __init__(self, ui_file, widget, store, treeview, new_row_data=None):
gnomeglade.Component.__init__(self, ui_file,
widget, store)
super().__init__(ui_file, widget, store)
self.new_row_data = new_row_data
self.list = getattr(self, treeview)
self.model = self.list.get_model()
......
......@@ -76,7 +76,7 @@ class MeldNotebook(Gtk.Notebook):
"""
def __init__(self, *args, **kwargs):
Gtk.Notebook.__init__(self, *args, **kwargs)
super().__init__(*args, **kwargs)
self.action_group = Gio.SimpleActionGroup()
......
......@@ -28,7 +28,7 @@ class NotebookLabel(Gtk.HBox):
tab_width_in_chars = 30
def __init__(self, iconname, text, onclose):
Gtk.HBox.__init__(self, homogeneous=False, spacing=4)
super().__init__(homogeneous=False, spacing=4)
label = Gtk.Label(label=text)
# FIXME: ideally, we would use custom ellipsization that ellipsized the
......
......@@ -69,7 +69,7 @@ class MeldStatusMenuButton(Gtk.MenuButton):
)
def __init__(self):
Gtk.MenuButton.__init__(self)
super().__init__()
style_context = self.get_style_context()
style_context.add_provider(
......
......@@ -105,7 +105,7 @@ class CommitDialog(GObject.GObject, Component):
class PushDialog(Component):
def __init__(self, parent):
Component.__init__(self, "vcview.ui", "pushdialog")
super().__init__("vcview.ui", "pushdialog")
self.widget.set_transient_for(parent.widget.get_toplevel())
self.widget.show_all()
......
......@@ -113,7 +113,7 @@ COL_LOCATION, COL_STATUS, COL_OPTIONS, COL_END = \
class VcTreeStore(tree.DiffTreeStore):
def __init__(self):
tree.DiffTreeStore.__init__(self, 1, [str] * 5)
super().__init__(1, [str] * 5)
def get_file_path(self, it):
return self.get_value(it, self.column_index(tree.COL_PATH, 0))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment