Various stylistic fixes

- Fix PEP8's line too long warning
- Remove useless parentheses
- Use triple quotes for docstring
- Address pylint's 'inconsistent-return-statements'
- Specify string format arguments as logging function parameters
- Comment out already disabled block of code
- Remove useless else (after return)
- Remove useless statement
- Do not import already imported module
This commit is contained in:
JoeLametta
2019-01-16 20:40:55 +00:00
parent 8dfcc5b5ec
commit 0e17b32740
18 changed files with 40 additions and 43 deletions

View File

@@ -25,7 +25,7 @@ logger = logging.getLogger(__name__)
# options) to the child command.
class BaseCommand():
class BaseCommand:
"""
Register and handle whipper command arguments with ArgumentParser.

View File

@@ -191,6 +191,8 @@ class _CD(BaseCommand):
if self.options.eject in ('success', 'always'):
utils.eject_device(self.device)
return None
def doCommand(self):
pass

View File

@@ -74,11 +74,11 @@ def main():
class Whipper(BaseCommand):
description = """whipper is a CD ripping utility focusing on accuracy over speed.
whipper gives you a tree of subcommands to work with.
You can get help on subcommands by using the -h option to the subcommand.
"""
description = (
"whipper is a CD ripping utility focusing on accuracy over speed.\n\n"
"whipper gives you a tree of subcommands to work with.\n"
"You can get help on subcommands by using the -h option "
"to the subcommand.\n")
no_add_help = True
subcommands = {
'accurip': accurip.AccuRip,

View File

@@ -42,3 +42,5 @@ Example disc id: KnpGsLhvH.lPrNc1PBL21lb9Bg4-"""
j + 1, track.artist.encode('utf-8'),
track.title.encode('utf-8')
))
return None

View File

@@ -94,7 +94,7 @@ CD in the AccurateRip database."""
except accurip.EntryNotFound:
logger.warning("AccurateRip entry not found: drive offset "
"can't be determined, try again with another disc")
return
return None
if responses:
logger.debug('%d AccurateRip responses found.', len(responses))
@@ -170,6 +170,8 @@ CD in the AccurateRip database."""
logger.error('no matching offset found. '
'Consider trying again with a different disc')
return None
def _arcs(self, runner, table, track, offset):
# rips the track with the given offset, return the arcs checksums
logger.debug('ripping track %r with offset %d...', track, offset)
@@ -196,7 +198,7 @@ CD in the AccurateRip database."""
)
os.unlink(path)
return ("%08x" % v1, "%08x" % v2)
return "%08x" % v1, "%08x" % v2
def _foundOffset(self, device, offset):
print('\nRead offset of device is: %d.' % offset)