diff --git a/meld/build_helpers.py b/meld/build_helpers.py index ed87583499ef3dacf6caad3228d620c168b1c336..d3ef58a83894116319b59e4006e0ed5547ec9172 100644 --- a/meld/build_helpers.py +++ b/meld/build_helpers.py @@ -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): diff --git a/meld/diffgrid.py b/meld/diffgrid.py index 22c8e56099ba1a70d360496a11bf9790fc230f42..1d05f8a9212c5663b59eba5bf56f50aeb41ea2b4 100644 --- a/meld/diffgrid.py +++ b/meld/diffgrid.py @@ -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 diff --git a/meld/diffmap.py b/meld/diffmap.py index a1ddd37f3073bbbdfb397b8cfa8672531bb00ac0..e70f2cad940b2922d2dd9b92ceb27dac784b7522 100644 --- a/meld/diffmap.py +++ b/meld/diffmap.py @@ -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 diff --git a/meld/dirdiff.py b/meld/dirdiff.py index 286171c1f2cee1ec088b70e2874c1692e6cdeb7f..c14e42df9a18797e3d5ad79f8d904f19bd6348ce 100644 --- a/meld/dirdiff.py +++ b/meld/dirdiff.py @@ -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: diff --git a/meld/filemerge.py b/meld/filemerge.py index 9f02f4bb3b3882e4e2d5768b96740dde0d30a8f3..861d9cc851aa1b0441fa3efd8c510a6adf4448d1 100644 --- a/meld/filemerge.py +++ b/meld/filemerge.py @@ -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): diff --git a/meld/matchers/diffutil.py b/meld/matchers/diffutil.py index 2b20fa842cc11087137fa890f6ba9f329102a058..de5dde069743d14142c7885d45bc1e8638b484cb 100644 --- a/meld/matchers/diffutil.py +++ b/meld/matchers/diffutil.py @@ -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 = [[], []] diff --git a/meld/matchers/merge.py b/meld/matchers/merge.py index 7760fb9fbf6960be5186d1e986a59faed3309900..d456a48e6ff75196b86602805b33051dfc08d248 100644 --- a/meld/matchers/merge.py +++ b/meld/matchers/merge.py @@ -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) diff --git a/meld/matchers/myers.py b/meld/matchers/myers.py index a5f06256d6d3c20ed3693661a5438a0e386250a8..b00aa358bb31773a081e938736b1322884882f18 100644 --- a/meld/matchers/myers.py +++ b/meld/matchers/myers.py @@ -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 = [] diff --git a/meld/meldapp.py b/meld/meldapp.py index 75bcc209890d7ac6304ac46dd5c6ab9f9f855888..a997c2f77a7dff40fc4bec06adf923bf344ffa2b 100644 --- a/meld/meldapp.py +++ b/meld/meldapp.py @@ -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 diff --git a/meld/meldbuffer.py b/meld/meldbuffer.py index 1f483ccd2b79896157e2ecbd1afccd45ba71f8e8..35e8f4f903927cc6fa0c9b5a8f47ab89386afa3a 100644 --- a/meld/meldbuffer.py +++ b/meld/meldbuffer.py @@ -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 diff --git a/meld/melddoc.py b/meld/melddoc.py index 1155f82689c9f336a153003cb88a06f673942435..5c8d7a72e7dc510e365f712a4e98c8b71db4356e 100644 --- a/meld/melddoc.py +++ b/meld/melddoc.py @@ -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 diff --git a/meld/meldwindow.py b/meld/meldwindow.py index dbfbc096b65e08db3f40806c1a49ab1b34c3ec22..4d66a281c0ed1077e400417b4ebb467059ee6575 100644 --- a/meld/meldwindow.py +++ b/meld/meldwindow.py @@ -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 = ( diff --git a/meld/preferences.py b/meld/preferences.py index 850f3ee22b23b847421c8d035314c6520f13dabc..d5f5ba80584dd06116ddcb303823ab8ae3f40a1e 100644 --- a/meld/preferences.py +++ b/meld/preferences.py @@ -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", diff --git a/meld/settings.py b/meld/settings.py index d7860ceff8b1e488fcfaf1d5c935a0bedb9dd88c..3d389b7045b1d1e52e94a77a217f37008d7f7524 100644 --- a/meld/settings.py +++ b/meld/settings.py @@ -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') diff --git a/meld/tree.py b/meld/tree.py index 8d76c893209c7cc26e32211b4f4d859f71809bbb..36b73e7ba891a492d86caef720a54f41facf70a8 100644 --- a/meld/tree.py +++ b/meld/tree.py @@ -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() diff --git a/meld/ui/filechooser.py b/meld/ui/filechooser.py index 861a2b0d72555cdc27bc27fa5839f7e645f24045..6fcc1501bcf0da4706e37062a5fbf9db3616166e 100644 --- a/meld/ui/filechooser.py +++ b/meld/ui/filechooser.py @@ -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: diff --git a/meld/ui/findbar.py b/meld/ui/findbar.py index aa67c6ad3391c77a6950c6fd14de486f5987031c..cf9a606ad080a7963c88e6fcfa1685a49e680ab7 100644 --- a/meld/ui/findbar.py +++ b/meld/ui/findbar.py @@ -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() diff --git a/meld/ui/listwidget.py b/meld/ui/listwidget.py index f8f063474813059ca62d36c2cecbdfbddc02bab3..efd3a5c98adc08ab9db377a1e6846262b40f14f2 100644 --- a/meld/ui/listwidget.py +++ b/meld/ui/listwidget.py @@ -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() diff --git a/meld/ui/notebook.py b/meld/ui/notebook.py index eaa21748d4e36418b5b00f061e203183a749dfce..343cbe98089e20ffa20489c0aca93a5325817983 100644 --- a/meld/ui/notebook.py +++ b/meld/ui/notebook.py @@ -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() diff --git a/meld/ui/notebooklabel.py b/meld/ui/notebooklabel.py index 9d1099b7c85f071ade8f2d832479eb79c9e8708a..5d36e22fa4267518c9cd942289be65612f3d6621 100644 --- a/meld/ui/notebooklabel.py +++ b/meld/ui/notebooklabel.py @@ -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 diff --git a/meld/ui/statusbar.py b/meld/ui/statusbar.py index 0cd06d23eb0e402050a7fd62186cebfd46aeefd4..fac49aeaaf9e607d817f755193c37bc61b9512c9 100644 --- a/meld/ui/statusbar.py +++ b/meld/ui/statusbar.py @@ -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( diff --git a/meld/ui/vcdialogs.py b/meld/ui/vcdialogs.py index 60499823ac3bfbf4c3aa1f21e3b281111801c793..74e4edc332ec383a67611f207c19eb0fb5feb114 100644 --- a/meld/ui/vcdialogs.py +++ b/meld/ui/vcdialogs.py @@ -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() diff --git a/meld/vcview.py b/meld/vcview.py index 68aef8045e0fb267f85d02a1e71da104105d1a02..6e2bd5afe7fd95219bee9903c269b1eaa46e08cd 100644 --- a/meld/vcview.py +++ b/meld/vcview.py @@ -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))