Rename 'throwaway' variables to single underscore

Also removed unused ones
This commit is contained in:
JoeLametta
2019-01-17 09:57:12 +00:00
parent 16b0d8dc29
commit e7bfc34c0e
14 changed files with 14 additions and 18 deletions

View File

@@ -52,7 +52,7 @@ def main():
return 1 return 1
except KeyboardInterrupt: except KeyboardInterrupt:
return 2 return 2
except ImportError as e: except ImportError:
raise raise
except task.TaskException as e: except task.TaskException as e:
if isinstance(e.exception, ImportError): if isinstance(e.exception, ImportError):

View File

@@ -88,7 +88,6 @@ CD in the AccurateRip database."""
table = t.table table = t.table
logger.debug("CDDB disc id: %r", table.getCDDBDiscId()) logger.debug("CDDB disc id: %r", table.getCDDBDiscId())
responses = None
try: try:
responses = accurip.get_db_entry(table.accuraterip_path()) responses = accurip.get_db_entry(table.accuraterip_path())
except accurip.EntryNotFound: except accurip.EntryNotFound:

View File

@@ -236,7 +236,7 @@ def print_report(result):
""" """
Print AccurateRip verification results. Print AccurateRip verification results.
""" """
for i, track in enumerate(result.tracks): for _, track in enumerate(result.tracks):
status = 'rip NOT accurate' status = 'rip NOT accurate'
conf = '(not found)' conf = '(not found)'
db = 'notfound' db = 'notfound'

View File

@@ -47,7 +47,7 @@ class CRC32Task(etask.Task):
def _crc32(self): def _crc32(self):
if not self.is_wave: if not self.is_wave:
fd, tmpf = tempfile.mkstemp() _, tmpf = tempfile.mkstemp()
try: try:
subprocess.check_call(['flac', '-d', self.path, '-fo', tmpf]) subprocess.check_call(['flac', '-d', self.path, '-fo', tmpf])

View File

@@ -156,7 +156,6 @@ class Config:
section = 'drive:' + urllib.quote('%s:%s:%s' % ( section = 'drive:' + urllib.quote('%s:%s:%s' % (
vendor, model, release)) vendor, model, release))
self._parser.add_section(section) self._parser.add_section(section)
__pychecker__ = 'no-local'
for key in ['vendor', 'model', 'release']: for key in ['vendor', 'model', 'release']:
self._parser.set(section, key, locals()[key].strip()) self._parser.set(section, key, locals()[key].strip())

View File

@@ -66,6 +66,6 @@ def getDeviceInfo(path):
except ImportError: except ImportError:
return None return None
device = cdio.Device(path) device = cdio.Device(path)
ok, vendor, model, release = device.get_hwinfo() _, vendor, model, release = device.get_hwinfo()
return vendor, model, release return vendor, model, release

View File

@@ -259,10 +259,8 @@ class Program:
ittoc.getAudioTracks())) ittoc.getAudioTracks()))
logger.debug('MusicBrainz submit url: %r', logger.debug('MusicBrainz submit url: %r',
ittoc.getMusicBrainzSubmitURL()) ittoc.getMusicBrainzSubmitURL())
ret = None
metadatas = None metadatas = None
e = None
for _ in range(0, 4): for _ in range(0, 4):
try: try:

View File

@@ -134,7 +134,7 @@ def perform_lookup(disc_id, freedb_server, freedb_port):
if len(matches) > 0: if len(matches) > 0:
# for each result, query FreeDB for XMCD file data # for each result, query FreeDB for XMCD file data
for (category, disc_id, title) in matches: for (category, disc_id, _) in matches:
sleep(1) # add a slight delay to keep the server happy sleep(1) # add a slight delay to keep the server happy
query = freedb_command(freedb_server, query = freedb_command(freedb_server,

View File

@@ -192,7 +192,7 @@ class ImageEncodeTask(task.MultiSeparateTask):
path = image.getRealPath(index.path) path = image.getRealPath(index.path)
assert isinstance(path, unicode), "%r is not unicode" % path assert isinstance(path, unicode), "%r is not unicode" % path
logger.debug('schedule encode of %r', path) logger.debug('schedule encode of %r', path)
root, ext = os.path.splitext(os.path.basename(path)) root, _ = os.path.splitext(os.path.basename(path))
outpath = os.path.join(outdir, root + '.' + 'flac') outpath = os.path.join(outdir, root + '.' + 'flac')
logger.debug('schedule encode to %r', outpath) logger.debug('schedule encode to %r', outpath)
taskk = encode.FlacEncodeTask( taskk = encode.FlacEncodeTask(

View File

@@ -117,7 +117,7 @@ class Sources:
""" """
Retrieve the source used at the given offset. Retrieve the source used at the given offset.
""" """
for i, (c, o, s) in enumerate(self._sources): for i, (_, o, _) in enumerate(self._sources):
if offset < o: if offset < o:
return self._sources[i - 1] return self._sources[i - 1]
@@ -127,7 +127,7 @@ class Sources:
""" """
Retrieve the absolute offset of the first source for this counter Retrieve the absolute offset of the first source for this counter
""" """
for i, (c, o, s) in enumerate(self._sources): for i, (c, _, _) in enumerate(self._sources):
if c == counter: if c == counter:
return self._sources[i][1] return self._sources[i][1]
@@ -151,7 +151,7 @@ class TocFile(object):
def _index(self, currentTrack, i, absoluteOffset, trackOffset): def _index(self, currentTrack, i, absoluteOffset, trackOffset):
absolute = absoluteOffset + trackOffset absolute = absoluteOffset + trackOffset
# this may be in a new source, so calculate relative # this may be in a new source, so calculate relative
c, o, s = self._sources.get(absolute) c, _, s = self._sources.get(absolute)
logger.debug('at abs offset %d, we are in source %r', logger.debug('at abs offset %d, we are in source %r',
absolute, s) absolute, s)
counterStart = self._sources.getCounterStart(c) counterStart = self._sources.getCounterStart(c)
@@ -341,7 +341,7 @@ class TocFile(object):
continue continue
length = common.msfToFrames(m.group('length')) length = common.msfToFrames(m.group('length'))
c, o, s = self._sources.get(absoluteOffset) c, _, s = self._sources.get(absoluteOffset)
logger.debug('at abs offset %d, we are in source %r', logger.debug('at abs offset %d, we are in source %r',
absoluteOffset, s) absoluteOffset, s)
counterStart = self._sources.getCounterStart(c) counterStart = self._sources.getCounterStart(c)

View File

@@ -31,7 +31,7 @@ def accuraterip_checksum(f, track_number, total_tracks, wave=False, v2=False):
if not wave: if not wave:
flac.stdout.close() flac.stdout.close()
out, err = arc.communicate() out, _ = arc.communicate()
if not wave: if not wave:
flac.wait() flac.wait()

View File

@@ -263,7 +263,7 @@ class ReadTrackTask(task.Task):
stopTrack = 0 stopTrack = 0
stopOffset = self._stop stopOffset = self._stop
for i, t in enumerate(self._table.tracks): for i, _ in enumerate(self._table.tracks):
if self._table.getTrackStart(i + 1) <= self._start: if self._table.getTrackStart(i + 1) <= self._start:
startTrack = i + 1 startTrack = i + 1
startOffset = self._start - self._table.getTrackStart(i + 1) startOffset = self._start - self._table.getTrackStart(i + 1)

View File

@@ -179,7 +179,7 @@ def version():
Return cdrdao version as a string. Return cdrdao version as a string.
""" """
cdrdao = Popen(CDRDAO, stderr=PIPE) cdrdao = Popen(CDRDAO, stderr=PIPE)
out, err = cdrdao.communicate() _, err = cdrdao.communicate()
if cdrdao.returncode != 1: if cdrdao.returncode != 1:
logger.warning("cdrdao version detection failed: " logger.warning("cdrdao version detection failed: "
"return code is %s", cdrdao.returncode) "return code is %s", cdrdao.returncode)

View File

@@ -18,7 +18,7 @@ def peak_level(track_path):
logger.warning("SoX peak detection failed: file not found") logger.warning("SoX peak detection failed: file not found")
return None return None
sox = Popen([SOX, track_path, "-n", "stats", "-b", "16"], stderr=PIPE) sox = Popen([SOX, track_path, "-n", "stats", "-b", "16"], stderr=PIPE)
out, err = sox.communicate() _, err = sox.communicate()
if sox.returncode: if sox.returncode:
logger.warning("SoX peak detection failed: %s", sox.returncode) logger.warning("SoX peak detection failed: %s", sox.returncode)
return None return None