Convert docstrings to reStructuredText
This commit also includes: - whitespace / code formatting fixes - slight syntax related changes: except <exception_name>, e -> except <exception_name> as e - 3 pointless instructions instances have been rewritten [sorted] (spotted by semi-automatic check) The unrelated changes shouldn't have any real impact on whipper's behaviour.
This commit is contained in:
@@ -26,8 +26,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class BaseCommand():
|
||||
"""
|
||||
A base command class for whipper commands.
|
||||
"""A base command class for whipper commands.
|
||||
|
||||
Creates an argparse.ArgumentParser.
|
||||
Override add_arguments() and handle_arguments() to register
|
||||
@@ -46,6 +45,7 @@ class BaseCommand():
|
||||
arguments, the current options namespace, and the full command path
|
||||
name.
|
||||
"""
|
||||
|
||||
device_option = False
|
||||
no_add_help = False # for rip.main.Whipper
|
||||
formatter_class = argparse.RawDescriptionHelpFormatter
|
||||
|
||||
@@ -175,7 +175,7 @@ class _CD(BaseCommand):
|
||||
try:
|
||||
self.program.result.cdparanoiaDefeatsCache = \
|
||||
self.config.getDefeatsCache(*info)
|
||||
except KeyError, e:
|
||||
except KeyError as e:
|
||||
logger.debug('Got key error: %r' % (e, ))
|
||||
self.program.result.artist = self.program.metadata \
|
||||
and self.program.metadata.artist \
|
||||
@@ -414,7 +414,7 @@ Log files will log the path to tracks relative to this directory.
|
||||
len(self.itable.tracks),
|
||||
extra))
|
||||
break
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.debug('Got exception %r on try %d',
|
||||
e, tries)
|
||||
|
||||
|
||||
@@ -118,9 +118,9 @@ class ResultCache(BaseCommand):
|
||||
description = summary
|
||||
|
||||
subcommands = {
|
||||
'cue': RCCue,
|
||||
'cue': RCCue,
|
||||
'list': RCList,
|
||||
'log': RCLog,
|
||||
'log': RCLog,
|
||||
}
|
||||
|
||||
|
||||
@@ -291,10 +291,10 @@ class Debug(BaseCommand):
|
||||
description = "debug internals"
|
||||
|
||||
subcommands = {
|
||||
'checksum': Checksum,
|
||||
'encode': Encode,
|
||||
'tag': Tag,
|
||||
'checksum': Checksum,
|
||||
'encode': Encode,
|
||||
'tag': Tag,
|
||||
'musicbrainzngs': MusicBrainzNGS,
|
||||
'resultcache': ResultCache,
|
||||
'version': Version,
|
||||
'resultcache': ResultCache,
|
||||
'version': Version,
|
||||
}
|
||||
|
||||
@@ -38,20 +38,20 @@ def main():
|
||||
try:
|
||||
cmd = Whipper(sys.argv[1:], os.path.basename(sys.argv[0]), None)
|
||||
ret = cmd.do()
|
||||
except SystemError, e:
|
||||
except SystemError as e:
|
||||
sys.stderr.write('whipper: error: %s\n' % e)
|
||||
if (type(e) is common.EjectError and
|
||||
cmd.options.eject in ('failure', 'always')):
|
||||
eject_device(e.device)
|
||||
return 255
|
||||
except RuntimeError, e:
|
||||
except RuntimeError as e:
|
||||
print(e)
|
||||
return 1
|
||||
except KeyboardInterrupt:
|
||||
return 2
|
||||
except ImportError, e:
|
||||
except ImportError as e:
|
||||
raise
|
||||
except task.TaskException, e:
|
||||
except task.TaskException as e:
|
||||
if isinstance(e.exception, ImportError):
|
||||
raise ImportError(e.exception)
|
||||
elif isinstance(e.exception, common.MissingDependencyException):
|
||||
@@ -80,11 +80,11 @@ You can get help on subcommands by using the -h option to the subcommand.
|
||||
no_add_help = True
|
||||
subcommands = {
|
||||
'accurip': accurip.AccuRip,
|
||||
'cd': cd.CD,
|
||||
'debug': debug.Debug,
|
||||
'drive': drive.Drive,
|
||||
'offset': offset.Offset,
|
||||
'image': image.Image
|
||||
'cd': cd.CD,
|
||||
'debug': debug.Debug,
|
||||
'drive': drive.Drive,
|
||||
'offset': offset.Offset,
|
||||
'image': image.Image
|
||||
}
|
||||
|
||||
def add_arguments(self):
|
||||
|
||||
@@ -119,7 +119,7 @@ CD in the AccurateRip database."""
|
||||
sys.stdout.write('Trying read offset %d ...\n' % offset)
|
||||
try:
|
||||
archecksums = self._arcs(runner, table, 1, offset)
|
||||
except task.TaskException, e:
|
||||
except task.TaskException as e:
|
||||
|
||||
# let MissingDependency fall through
|
||||
if isinstance(e.exception,
|
||||
@@ -152,7 +152,7 @@ CD in the AccurateRip database."""
|
||||
for track in range(2, (len(table.tracks) + 1) - 1):
|
||||
try:
|
||||
archecksums = self._arcs(runner, table, track, offset)
|
||||
except task.TaskException, e:
|
||||
except task.TaskException as e:
|
||||
if isinstance(e.exception, cdparanoia.FileSizeError):
|
||||
sys.stdout.write(
|
||||
'WARNING: cannot rip with offset %d...\n' %
|
||||
@@ -195,11 +195,11 @@ CD in the AccurateRip database."""
|
||||
runner.run(t)
|
||||
|
||||
v1 = arc.accuraterip_checksum(
|
||||
path, track, len(table.tracks), wave=True, v2=False
|
||||
)
|
||||
path, track, len(table.tracks), wave=True, v2=False
|
||||
)
|
||||
v2 = arc.accuraterip_checksum(
|
||||
path, track, len(table.tracks), wave=True, v2=True
|
||||
)
|
||||
path, track, len(table.tracks), wave=True, v2=True
|
||||
)
|
||||
|
||||
os.unlink(path)
|
||||
return ("%08x" % v1, "%08x" % v2)
|
||||
|
||||
Reference in New Issue
Block a user