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
except KeyboardInterrupt:
return 2
except ImportError as e:
except ImportError:
raise
except task.TaskException as e:
if isinstance(e.exception, ImportError):

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -134,7 +134,7 @@ def perform_lookup(disc_id, freedb_server, freedb_port):
if len(matches) > 0:
# 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
query = freedb_command(freedb_server,

View File

@@ -192,7 +192,7 @@ class ImageEncodeTask(task.MultiSeparateTask):
path = image.getRealPath(index.path)
assert isinstance(path, unicode), "%r is not unicode" % 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')
logger.debug('schedule encode to %r', outpath)
taskk = encode.FlacEncodeTask(

View File

@@ -117,7 +117,7 @@ class Sources:
"""
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:
return self._sources[i - 1]
@@ -127,7 +127,7 @@ class Sources:
"""
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:
return self._sources[i][1]
@@ -151,7 +151,7 @@ class TocFile(object):
def _index(self, currentTrack, i, absoluteOffset, trackOffset):
absolute = absoluteOffset + trackOffset
# 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',
absolute, s)
counterStart = self._sources.getCounterStart(c)
@@ -341,7 +341,7 @@ class TocFile(object):
continue
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',
absoluteOffset, s)
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:
flac.stdout.close()
out, err = arc.communicate()
out, _ = arc.communicate()
if not wave:
flac.wait()

View File

@@ -263,7 +263,7 @@ class ReadTrackTask(task.Task):
stopTrack = 0
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:
startTrack = i + 1
startOffset = self._start - self._table.getTrackStart(i + 1)

View File

@@ -179,7 +179,7 @@ def version():
Return cdrdao version as a string.
"""
cdrdao = Popen(CDRDAO, stderr=PIPE)
out, err = cdrdao.communicate()
_, err = cdrdao.communicate()
if cdrdao.returncode != 1:
logger.warning("cdrdao version detection failed: "
"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")
return None
sox = Popen([SOX, track_path, "-n", "stats", "-b", "16"], stderr=PIPE)
out, err = sox.communicate()
_, err = sox.communicate()
if sox.returncode:
logger.warning("SoX peak detection failed: %s", sox.returncode)
return None