Skip to content

Commit 16b0d8d

Browse files
committed
Make methods static
1 parent af90c1c commit 16b0d8d

File tree

8 files changed

+31
-14
lines changed

8 files changed

+31
-14
lines changed

whipper/command/offset.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,8 @@ def _arcs(self, runner, table, track, offset):
200200
os.unlink(path)
201201
return "%08x" % v1, "%08x" % v2
202202

203-
def _foundOffset(self, device, offset):
203+
@staticmethod
204+
def _foundOffset(device, offset):
204205
print('\nRead offset of device is: %d.' % offset)
205206

206207
info = drive.getDeviceInfo(device)

whipper/common/program.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ def __init__(self, config, record=False):
8181

8282
self._filter = path.PathFilter(**d)
8383

84-
def setWorkingDirectory(self, workingDirectory):
84+
@staticmethod
85+
def setWorkingDirectory(workingDirectory):
8586
if workingDirectory:
8687
logger.info('changing to working directory %s', workingDirectory)
8788
os.chdir(workingDirectory)
@@ -140,7 +141,11 @@ def getRipResult(self, cddbdiscid):
140141

141142
return self.result
142143

143-
def addDisambiguation(self, template_part, metadata):
144+
def saveRipResult(self):
145+
self._presult.persist()
146+
147+
@staticmethod
148+
def addDisambiguation(template_part, metadata):
144149
"""Add disambiguation to template path part string."""
145150
if metadata.catalogNumber:
146151
template_part += ' (%s)' % metadata.catalogNumber
@@ -218,7 +223,8 @@ def getPath(self, outdir, template, mbdiscid, metadata, track_number=None):
218223
template = re.sub(r'%(\w)', r'%(\1)s', template)
219224
return os.path.join(outdir, template % v)
220225

221-
def getCDDB(self, cddbdiscid):
226+
@staticmethod
227+
def getCDDB(cddbdiscid):
222228
"""
223229
@param cddbdiscid: list of id, tracks, offsets, seconds
224230
@@ -440,7 +446,8 @@ def getHTOA(self):
440446
stop = track.getIndex(1).absolute - 1
441447
return start, stop
442448

443-
def verifyTrack(self, runner, trackResult):
449+
@staticmethod
450+
def verifyTrack(runner, trackResult):
444451
is_wave = not trackResult.filename.endswith('.flac')
445452
t = checksum.CRC32Task(trackResult.filename, is_wave=is_wave)
446453

whipper/extern/task/task.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,16 @@ class LogStub(object):
7474
I am a stub for a log interface.
7575
"""
7676

77-
def log(self, message, *args):
77+
@staticmethod
78+
def log(message, *args):
7879
logger.info(message, *args)
7980

80-
def debug(self, message, *args):
81+
@staticmethod
82+
def debug(message, *args):
8183
logger.debug(message, *args)
8284

83-
def warning(self, message, *args):
85+
@staticmethod
86+
def warning(message, *args):
8487
logger.warning(message, *args)
8588

8689

whipper/image/table.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ def hasDataTracks(self):
249249
"""
250250
return len([t for t in self.tracks if not t.audio]) > 0
251251

252-
def _cddbSum(self, i):
252+
@staticmethod
253+
def _cddbSum(i):
253254
ret = 0
254255
while i > 0:
255256
ret += (i % 10)
@@ -728,7 +729,8 @@ def merge(self, other, session=2):
728729
self.leadout += other.leadout + gap # FIXME
729730
logger.debug('fixing leadout, now %d', self.leadout)
730731

731-
def _getSessionGap(self, session):
732+
@staticmethod
733+
def _getSessionGap(session):
732734
# From cdrecord multi-session info:
733735
# For the first additional session this is 11250 sectors
734736
# lead-out/lead-in overhead + 150 sectors for the pre-gap of the first

whipper/result/result.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ def log(self, ripResult, epoch=time.time()):
140140
class EntryPoint(object):
141141
name = 'whipper'
142142

143-
def load(self):
143+
@staticmethod
144+
def load():
144145
from whipper.result import logger
145146
return logger.WhipperLogger
146147

whipper/test/common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ def failUnlessRaises(self, exception, f, *args, **kwargs):
6262

6363
assertRaises = failUnlessRaises
6464

65-
def readCue(self, name):
65+
@staticmethod
66+
def readCue(name):
6667
"""
6768
Read a .cue file, and replace the version comment with the current
6869
version so we can use it in comparisons.

whipper/test/test_image_cue.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ def testGetTrackLength(self):
5959

6060
class WriteCueFileTestCase(unittest.TestCase):
6161

62-
def testWrite(self):
62+
@staticmethod
63+
def testWrite():
6364
fd, path = tempfile.mkstemp(suffix=u'.whipper.test.cue')
6465
os.close(fd)
6566

whipper/test/test_image_toc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ def testIndexes(self):
353353
'strokes-someday.eac.cue')).read()).decode('utf-8')
354354
common.diffStrings(ref, cue)
355355

356-
def _filterCue(self, output):
356+
@staticmethod
357+
def _filterCue(output):
357358
# helper to be able to compare our generated .cue with the
358359
# EAC-extracted one
359360
discard = ['TITLE', 'PERFORMER', 'FLAGS', 'REM']

0 commit comments

Comments
 (0)