Skip to content

Commit 3a90da8

Browse files
committed
Calling super() whenever possible
1 parent f5363fe commit 3a90da8

23 files changed

Lines changed: 38 additions & 42 deletions

meld/build_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class MeldDistribution(distutils.dist.Distribution):
6565
def __init__(self, *args, **kwargs):
6666
self.no_update_icon_cache = False
6767
self.no_compile_schemas = False
68-
distutils.dist.Distribution.__init__(self, *args, **kwargs)
68+
super().__init__(*args, **kwargs)
6969

7070

7171
class build_data(distutils.cmd.Command):

meld/diffgrid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class DiffGrid(Gtk.Grid):
2222
__gtype_name__ = "DiffGrid"
2323

2424
def __init__(self):
25-
Gtk.Grid.__init__(self)
25+
super().__init__()
2626
self._in_drag = False
2727
self._drag_pos = -1
2828
self._drag_handle = None

meld/diffmap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class DiffMap(Gtk.DrawingArea):
2929
__gtype_name__ = "DiffMap"
3030

3131
def __init__(self):
32-
Gtk.DrawingArea.__init__(self)
32+
super().__init__()
3333
self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
3434
self._last_allocation = None
3535
self._scrolladj = None

meld/dirdiff.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,7 @@ def _files_same(files, regexes, comparison_args):
206206

207207
class DirDiffTreeStore(tree.DiffTreeStore):
208208
def __init__(self, ntree):
209-
tree.DiffTreeStore.__init__(
210-
self, ntree, [str, str, object, object, object])
209+
super().__init__(ntree, [str, str, object, object, object])
211210

212211

213212
class CanonicalListing:

meld/filemerge.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ class FileMerge(FileDiff):
2525
differ = merge.AutoMergeDiffer
2626

2727
def _connect_buffer_handlers(self):
28-
FileDiff._connect_buffer_handlers(self)
28+
super()._connect_buffer_handlers()
2929
self.textview[0].set_editable(0)
3030
self.textview[2].set_editable(0)
3131

3232
def get_comparison(self):
33-
comp = FileDiff.get_comparison(self)
33+
comp = super().get_comparison()
3434
return RecentType.Merge, comp[1]
3535

3636
def _merge_files(self):

meld/matchers/diffutil.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Differ(GObject.GObject):
7878

7979
def __init__(self):
8080
# Internally, diffs are stored from text1 -> text0 and text1 -> text2.
81-
GObject.GObject.__init__(self)
81+
super().__init__()
8282
self.num_sequences = 0
8383
self.seqlength = [0, 0, 0]
8484
self.diffs = [[], []]

meld/matchers/merge.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ class AutoMergeDiffer(diffutil.Differ):
2323
# _matcher = PatienceSequenceMatcher
2424

2525
def __init__(self):
26-
diffutil.Differ.__init__(self)
26+
super().__init__()
2727
self.auto_merge = False
2828
self.unresolved = []
2929

3030
def _auto_merge(self, using, texts):
31-
for out0, out1 in diffutil.Differ._auto_merge(self, using, texts):
31+
for out0, out1 in super()._auto_merge(using, texts):
3232
if self.auto_merge and out0[0] == 'conflict':
3333
# we will try to resolve more complex conflicts automatically
3434
# here... if possible
@@ -195,8 +195,7 @@ def change_sequence(self, sequence, startidx, sizechange, texts):
195195
]
196196
self.unresolved[lo:hi] = []
197197

198-
return diffutil.Differ.change_sequence(
199-
self, sequence, startidx, sizechange, texts)
198+
return super().change_sequence(sequence, startidx, sizechange, texts)
200199

201200
def get_unresolved_count(self):
202201
return len(self.unresolved)

meld/matchers/myers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def get_matching_blocks(self):
8383
return self.matching_blocks
8484

8585
def get_opcodes(self):
86-
opcodes = difflib.SequenceMatcher.get_opcodes(self)
86+
opcodes = super().get_opcodes()
8787
return [DiffChunk._make(chunk) for chunk in opcodes]
8888

8989
def get_difference_opcodes(self):
@@ -349,13 +349,13 @@ def index_matching_kmers(a, b):
349349
class SyncPointMyersSequenceMatcher(MyersSequenceMatcher):
350350

351351
def __init__(self, isjunk=None, a="", b="", syncpoints=None):
352-
MyersSequenceMatcher.__init__(self, isjunk, a, b)
352+
super().__init__(isjunk, a, b)
353353
self.isjunk = isjunk
354354
self.syncpoints = syncpoints
355355

356356
def initialise(self):
357357
if self.syncpoints is None or len(self.syncpoints) == 0:
358-
for i in MyersSequenceMatcher.initialise(self):
358+
for i in super().initialise():
359359
yield i
360360
else:
361361
chunks = []

meld/meldapp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
class MeldApp(Gtk.Application):
4444

4545
def __init__(self):
46-
Gtk.Application.__init__(self)
46+
super().__init__()
4747
self.set_flags(Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
4848
self.set_application_id("org.gnome.meld")
4949
GLib.set_application_name("Meld")
@@ -200,7 +200,7 @@ def __init__(self, command_line, *args, **kwargs):
200200
self.should_exit = False
201201
self.output = io.StringIO()
202202
self.exit_status = 0
203-
optparse.OptionParser.__init__(self, *args, **kwargs)
203+
super().__init__(*args, **kwargs)
204204

205205
def exit(self, status=0, msg=None):
206206
self.should_exit = True

meld/meldbuffer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class MeldBuffer(GtkSource.Buffer):
3737
)
3838

3939
def __init__(self):
40-
GtkSource.Buffer.__init__(self)
40+
super().__init__()
4141
bind_settings(self)
4242
self.data = MeldBufferData()
4343
self.undo_sequence = None
@@ -98,7 +98,7 @@ class MeldBufferData(GObject.GObject):
9898
)
9999

100100
def __init__(self):
101-
GObject.GObject.__init__(self)
101+
super().__init__()
102102
self._gfile = None
103103
self._label = None
104104
self._monitor = None

0 commit comments

Comments
 (0)