Skip to content

Commit 5bcd63f

Browse files
committed
pylint: enable import-error, no-name-in-module, no-self-use
1 parent 032e9a3 commit 5bcd63f

File tree

9 files changed

+38
-24
lines changed

9 files changed

+38
-24
lines changed

.pylintrc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,10 @@ disable=raw-checker-failed,
9090
# temporary silenced messages (ordered alphabetically)
9191
duplicate-code,
9292
fixme,
93-
import-error,
9493
invalid-name,
9594
missing-class-docstring,
9695
missing-function-docstring,
9796
missing-module-docstring,
98-
no-name-in-module,
99-
no-self-use,
10097
too-few-public-methods,
10198
too-many-arguments,
10299
too-many-branches,

src/diffuse/dialogs.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
from gi.repository import GObject, Gtk
2727
# pylint: enable=wrong-import-position
2828

29+
# pylint: disable-next=no-name-in-module
2930
from diffuse import constants
31+
3032
from diffuse import utils
3133

3234
# the about dialog
@@ -67,7 +69,8 @@ class FileChooserDialog(Gtk.FileChooserDialog):
6769
# location for empty panes
6870
last_chosen_folder = os.path.realpath(os.curdir)
6971

70-
def __current_folder_changed_cb(self, widget):
72+
@staticmethod
73+
def _current_folder_changed_cb(widget):
7174
FileChooserDialog.last_chosen_folder = widget.get_current_folder()
7275

7376
def __init__(self, title, parent, prefs, action, accept, rev=False):
@@ -96,7 +99,7 @@ def __init__(self, title, parent, prefs, action, accept, rev=False):
9699
self.vbox.pack_start(hbox, False, False, 0) # pylint: disable=no-member
97100
hbox.show()
98101
self.set_current_folder(self.last_chosen_folder)
99-
self.connect('current-folder-changed', self.__current_folder_changed_cb)
102+
self.connect('current-folder-changed', self._current_folder_changed_cb)
100103

101104
def set_encoding(self, encoding):
102105
self.encoding.set_text(encoding)

src/diffuse/main.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838

3939
from urllib.parse import urlparse
4040

41+
# pylint: disable-next=no-name-in-module
4142
from diffuse import constants
43+
4244
from diffuse import utils
4345
from diffuse.dialogs import AboutDialog, FileChooserDialog, NumericDialog, SearchDialog
4446
from diffuse.preferences import Preferences
@@ -931,11 +933,11 @@ def saveState(self, statepath):
931933
utils.logDebug(f'Error writing {statepath}.')
932934

933935
# select viewer for a newly selected file in the confirm close dialogue
934-
def __confirmClose_row_activated_cb(self, tree, path, col, model):
936+
def _confirmClose_row_activated_cb(self, tree, path, col, model):
935937
self.notebook.set_current_page(self.notebook.page_num(model[path][3]))
936938

937939
# toggle save state for a file listed in the confirm close dialogue
938-
def __confirmClose_toggle_cb(self, cell, path, model):
940+
def _confirmClose_toggle_cb(self, cell, path, model):
939941
model[path][0] = not model[path][0]
940942

941943
# returns True if the list of viewers can be closed. The user will be
@@ -968,7 +970,7 @@ def confirmCloseViewers(self, viewers):
968970
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
969971
treeview = Gtk.TreeView.new_with_model(model)
970972
r = Gtk.CellRendererToggle.new()
971-
r.connect('toggled', self.__confirmClose_toggle_cb, model)
973+
r.connect('toggled', self._confirmClose_toggle_cb, model)
972974
column = Gtk.TreeViewColumn(None, r)
973975
column.add_attribute(r, 'active', 0)
974976
treeview.append_column(column)
@@ -982,7 +984,7 @@ def confirmCloseViewers(self, viewers):
982984
column.set_resizable(True)
983985
column.set_sort_column_id(2)
984986
treeview.append_column(column)
985-
treeview.connect('row-activated', self.__confirmClose_row_activated_cb, model)
987+
treeview.connect('row-activated', self._confirmClose_row_activated_cb, model)
986988
sw.add(treeview)
987989
treeview.show()
988990
dialog.vbox.pack_start(sw, True, True, 0) # pylint: disable=no-member

src/diffuse/preferences.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@
2929
from gi.repository import Gtk
3030
# pylint: enable=wrong-import-position
3131

32-
from diffuse import utils
32+
# pylint: disable-next=no-name-in-module
3333
from diffuse import constants
3434

35+
from diffuse import utils
36+
3537
# class to store preferences and construct a dialogue for manipulating them
3638
class Preferences:
3739
def __init__(self, path):

src/diffuse/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from gi.repository import Gtk
3030
# pylint: enable=wrong-import-position
3131

32+
# pylint: disable-next=no-name-in-module
3233
from diffuse import constants
3334

3435
# convenience class for displaying a message dialogue

src/diffuse/vcs/rcs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def getCommitTemplate(self, prefs, rev, names):
6060
return result
6161

6262
# simulate use of popen with xargs to read the output of a command
63-
def _popen_xargs_readlines(self, dn, cmd, args, prefs, bash_pref):
63+
def _popen_xargs_readlines(self, cmd, args, prefs, bash_pref):
6464
# os.sysconf() is only available on Unix
6565
if hasattr(os, 'sysconf'):
6666
maxsize = os.sysconf('SC_ARG_MAX')
@@ -85,7 +85,7 @@ def _popen_xargs_readlines(self, dn, cmd, args, prefs, bash_pref):
8585
s += len(args[i]) + 1
8686
i += 1
8787
if i == len(args) or not f:
88-
ss.extend(utils.popenReadLines(dn, a, prefs, bash_pref))
88+
ss.extend(utils.popenReadLines(self.root, a, prefs, bash_pref))
8989
s, a = 0, []
9090
return ss
9191

@@ -138,7 +138,7 @@ def getFolderTemplate(self, prefs, names):
138138
args = [ utils.safeRelativePath(self.root, k, prefs, 'rcs_cygwin') for k in r ]
139139
# run command
140140
r, k = {}, ''
141-
for line in self._popen_xargs_readlines(self.root, cmd, args, prefs, 'rcs_bash'):
141+
for line in self._popen_xargs_readlines(cmd, args, prefs, 'rcs_bash'):
142142
# parse response
143143
if line.startswith('Working file: '):
144144
k = prefs.convertToNativePath(line[14:])

src/diffuse/vcs/svk.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,22 @@
2323
from diffuse.vcs.svn import Svn
2424

2525
class Svk(Svn):
26-
def _getVcs(self):
26+
@staticmethod
27+
def _getVcs():
2728
return 'svk'
2829

29-
def _getURLPrefix(self):
30+
@staticmethod
31+
def _getURLPrefix():
3032
return 'Depot Path: '
3133

32-
def _parseStatusLine(self, s):
34+
@staticmethod
35+
def _parseStatusLine(s):
3336
if len(s) < 4 or s[0] not in 'ACDMR':
3437
return '', ''
3538
return s[0], s[4:]
3639

37-
def _getPreviousRevision(self, rev):
40+
@staticmethod
41+
def _getPreviousRevision(rev):
3842
if rev is None:
3943
return 'HEAD'
4044
if rev.endswith('@'):

src/diffuse/vcs/svn.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,16 @@ def __init__(self, root):
3131
VcsInterface.__init__(self, root)
3232
self.url = None
3333

34-
def _getVcs(self):
34+
@staticmethod
35+
def _getVcs():
3536
return 'svn'
3637

37-
def _getURLPrefix(self):
38+
@staticmethod
39+
def _getURLPrefix():
3840
return 'URL: '
3941

40-
def _parseStatusLine(self, s):
42+
@staticmethod
43+
def _parseStatusLine(s):
4144
if len(s) < 8 or s[0] not in 'ACDMR':
4245
return '', ''
4346
# subversion 1.6 adds a new column
@@ -46,7 +49,8 @@ def _parseStatusLine(self, s):
4649
k += 1
4750
return s[0], s[k:]
4851

49-
def _getPreviousRevision(self, rev):
52+
@staticmethod
53+
def _getPreviousRevision(rev):
5054
if rev is None:
5155
return 'BASE'
5256
m = int(rev)

src/diffuse/widgets.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,7 +1649,8 @@ def _ensure_cursor_is_visible(self):
16491649
# scroll vertically to current line
16501650
self._ensure_line_is_visible(current_line)
16511651

1652-
def __set_clipboard_text(self, clipboard, s):
1652+
@staticmethod
1653+
def _set_clipboard_text(clipboard, s):
16531654
# remove embedded nulls as the clipboard cannot handle them
16541655
Gtk.Clipboard.get(clipboard).set_text(s.replace('\0', ''), -1)
16551656

@@ -1673,7 +1674,7 @@ def setCurrentChar(self, i, j, si=None, sj=None):
16731674
self.selection_char = sj
16741675

16751676
if extend:
1676-
self.__set_clipboard_text(Gdk.SELECTION_PRIMARY, self.getSelectedText())
1677+
self._set_clipboard_text(Gdk.SELECTION_PRIMARY, self.getSelectedText())
16771678

16781679
self._cursor_position_changed(True)
16791680
self.emit('cursor_changed')
@@ -2922,7 +2923,7 @@ def key_press_cb(self, widget, event):
29222923
# 'copy' action
29232924
def copy(self):
29242925
if self.mode in (LINE_MODE, CHAR_MODE):
2925-
self.__set_clipboard_text(Gdk.SELECTION_CLIPBOARD, self.getSelectedText())
2926+
self._set_clipboard_text(Gdk.SELECTION_CLIPBOARD, self.getSelectedText())
29262927

29272928
# 'cut' action
29282929
def cut(self):

0 commit comments

Comments
 (0)