Make methods static
This commit is contained in:
@@ -200,7 +200,8 @@ CD in the AccurateRip database."""
|
||||
os.unlink(path)
|
||||
return "%08x" % v1, "%08x" % v2
|
||||
|
||||
def _foundOffset(self, device, offset):
|
||||
@staticmethod
|
||||
def _foundOffset(device, offset):
|
||||
print('\nRead offset of device is: %d.' % offset)
|
||||
|
||||
info = drive.getDeviceInfo(device)
|
||||
|
||||
@@ -81,7 +81,8 @@ class Program:
|
||||
|
||||
self._filter = path.PathFilter(**d)
|
||||
|
||||
def setWorkingDirectory(self, workingDirectory):
|
||||
@staticmethod
|
||||
def setWorkingDirectory(workingDirectory):
|
||||
if workingDirectory:
|
||||
logger.info('changing to working directory %s', workingDirectory)
|
||||
os.chdir(workingDirectory)
|
||||
@@ -140,7 +141,11 @@ class Program:
|
||||
|
||||
return self.result
|
||||
|
||||
def addDisambiguation(self, template_part, metadata):
|
||||
def saveRipResult(self):
|
||||
self._presult.persist()
|
||||
|
||||
@staticmethod
|
||||
def addDisambiguation(template_part, metadata):
|
||||
"""Add disambiguation to template path part string."""
|
||||
if metadata.catalogNumber:
|
||||
template_part += ' (%s)' % metadata.catalogNumber
|
||||
@@ -218,7 +223,8 @@ class Program:
|
||||
template = re.sub(r'%(\w)', r'%(\1)s', template)
|
||||
return os.path.join(outdir, template % v)
|
||||
|
||||
def getCDDB(self, cddbdiscid):
|
||||
@staticmethod
|
||||
def getCDDB(cddbdiscid):
|
||||
"""
|
||||
@param cddbdiscid: list of id, tracks, offsets, seconds
|
||||
|
||||
@@ -440,7 +446,8 @@ class Program:
|
||||
stop = track.getIndex(1).absolute - 1
|
||||
return start, stop
|
||||
|
||||
def verifyTrack(self, runner, trackResult):
|
||||
@staticmethod
|
||||
def verifyTrack(runner, trackResult):
|
||||
is_wave = not trackResult.filename.endswith('.flac')
|
||||
t = checksum.CRC32Task(trackResult.filename, is_wave=is_wave)
|
||||
|
||||
|
||||
9
whipper/extern/task/task.py
vendored
9
whipper/extern/task/task.py
vendored
@@ -74,13 +74,16 @@ class LogStub(object):
|
||||
I am a stub for a log interface.
|
||||
"""
|
||||
|
||||
def log(self, message, *args):
|
||||
@staticmethod
|
||||
def log(message, *args):
|
||||
logger.info(message, *args)
|
||||
|
||||
def debug(self, message, *args):
|
||||
@staticmethod
|
||||
def debug(message, *args):
|
||||
logger.debug(message, *args)
|
||||
|
||||
def warning(self, message, *args):
|
||||
@staticmethod
|
||||
def warning(message, *args):
|
||||
logger.warning(message, *args)
|
||||
|
||||
|
||||
|
||||
@@ -249,7 +249,8 @@ class Table(object):
|
||||
"""
|
||||
return len([t for t in self.tracks if not t.audio]) > 0
|
||||
|
||||
def _cddbSum(self, i):
|
||||
@staticmethod
|
||||
def _cddbSum(i):
|
||||
ret = 0
|
||||
while i > 0:
|
||||
ret += (i % 10)
|
||||
@@ -728,7 +729,8 @@ class Table(object):
|
||||
self.leadout += other.leadout + gap # FIXME
|
||||
logger.debug('fixing leadout, now %d', self.leadout)
|
||||
|
||||
def _getSessionGap(self, session):
|
||||
@staticmethod
|
||||
def _getSessionGap(session):
|
||||
# From cdrecord multi-session info:
|
||||
# For the first additional session this is 11250 sectors
|
||||
# lead-out/lead-in overhead + 150 sectors for the pre-gap of the first
|
||||
|
||||
@@ -140,7 +140,8 @@ class Logger(object):
|
||||
class EntryPoint(object):
|
||||
name = 'whipper'
|
||||
|
||||
def load(self):
|
||||
@staticmethod
|
||||
def load():
|
||||
from whipper.result import logger
|
||||
return logger.WhipperLogger
|
||||
|
||||
|
||||
@@ -62,7 +62,8 @@ class TestCase(unittest.TestCase):
|
||||
|
||||
assertRaises = failUnlessRaises
|
||||
|
||||
def readCue(self, name):
|
||||
@staticmethod
|
||||
def readCue(name):
|
||||
"""
|
||||
Read a .cue file, and replace the version comment with the current
|
||||
version so we can use it in comparisons.
|
||||
|
||||
@@ -59,7 +59,8 @@ class KanyeMixedTestCase(unittest.TestCase):
|
||||
|
||||
class WriteCueFileTestCase(unittest.TestCase):
|
||||
|
||||
def testWrite(self):
|
||||
@staticmethod
|
||||
def testWrite():
|
||||
fd, path = tempfile.mkstemp(suffix=u'.whipper.test.cue')
|
||||
os.close(fd)
|
||||
|
||||
|
||||
@@ -353,7 +353,8 @@ class StrokesTestCase(common.TestCase):
|
||||
'strokes-someday.eac.cue')).read()).decode('utf-8')
|
||||
common.diffStrings(ref, cue)
|
||||
|
||||
def _filterCue(self, output):
|
||||
@staticmethod
|
||||
def _filterCue(output):
|
||||
# helper to be able to compare our generated .cue with the
|
||||
# EAC-extracted one
|
||||
discard = ['TITLE', 'PERFORMER', 'FLAGS', 'REM']
|
||||
|
||||
Reference in New Issue
Block a user