Avoid shadowing built-ins/variables

This commit is contained in:
JoeLametta
2019-01-16 21:21:21 +00:00
parent fef7973113
commit 5311727572
8 changed files with 28 additions and 28 deletions

View File

@@ -572,10 +572,10 @@ class Program:
return cuePath
def writeLog(self, discName, logger):
def writeLog(self, discName, txt_logger):
logPath = common.truncate_filename(discName + '.log')
handle = open(logPath, 'w')
log = logger.log(self.result)
log = txt_logger.log(self.result)
handle.write(log.encode('utf-8'))
handle.close()

View File

@@ -115,13 +115,13 @@ class PopenTask(task.Task):
os.kill(self._popen.pid, signal.SIGTERM)
# self.stop()
def readbytesout(self, bytes):
def readbytesout(self, bytes_stdout):
"""
Called when bytes have been read from stdout.
"""
pass
def readbyteserr(self, bytes):
def readbyteserr(self, bytes_stderr):
"""
Called when bytes have been read from stderr.
"""

View File

@@ -28,8 +28,8 @@ class Popen(subprocess.Popen):
def recv_err(self, maxsize=None):
return self._recv('stderr', maxsize)
def send_recv(self, input='', maxsize=None):
return self.send(input), self.recv(maxsize), self.recv_err(maxsize)
def send_recv(self, in_put='', maxsize=None):
return self.send(in_put), self.recv(maxsize), self.recv_err(maxsize)
def get_conn_maxsize(self, which, maxsize):
if maxsize is None:
@@ -44,13 +44,13 @@ class Popen(subprocess.Popen):
if subprocess.mswindows:
def send(self, input):
def send(self, in_put):
if not self.stdin:
return None
try:
x = msvcrt.get_osfhandle(self.stdin.fileno())
(errCode, written) = WriteFile(x, input)
(errCode, written) = WriteFile(x, in_put)
except ValueError:
return self._close('stdin')
except (subprocess.pywintypes.error, Exception) as why:
@@ -85,7 +85,7 @@ class Popen(subprocess.Popen):
else:
def send(self, input):
def send(self, in_put):
if not self.stdin:
return None
@@ -93,7 +93,7 @@ class Popen(subprocess.Popen):
return 0
try:
written = os.write(self.stdin.fileno(), input)
written = os.write(self.stdin.fileno(), in_put)
except OSError as why:
if why.args[0] == errno.EPIPE: # broken pipe
return self._close('stdin')

View File

@@ -210,13 +210,13 @@ class Task(LogStub):
self.debug('set exception, %r, %r' % (
exception, self.exceptionMessage))
def schedule(self, delta, callable, *args, **kwargs):
def schedule(self, delta, callable_task, *args, **kwargs):
if not self.runner:
print("ERROR: scheduling on a task that's altready stopped")
import traceback
traceback.print_stack()
return
self.runner.schedule(self, delta, callable, *args, **kwargs)
self.runner.schedule(self, delta, callable_task, *args, **kwargs)
def addListener(self, listener):
"""
@@ -446,7 +446,7 @@ class TaskRunner(LogStub):
raise NotImplementedError
# methods for tasks to call
def schedule(self, delta, callable, *args, **kwargs):
def schedule(self, delta, callable_task, *args, **kwargs):
"""
Schedule a single future call.
@@ -507,21 +507,21 @@ class SyncRunner(TaskRunner, ITaskListener):
self.debug('exception during start: %r', task.exceptionMessage)
self.stopped(task)
def schedule(self, task, delta, callable, *args, **kwargs):
def schedule(self, task, delta, callable_task, *args, **kwargs):
def c():
try:
self.debug('schedule: calling %r(*args=%r, **kwargs=%r)',
callable, args, kwargs)
callable(*args, **kwargs)
callable_task, args, kwargs)
callable_task(*args, **kwargs)
return False
except Exception as e:
self.debug('exception when calling scheduled callable %r',
callable)
callable_task)
task.setException(e)
self.stopped(task)
raise
self.debug('schedule: scheduling %r(*args=%r, **kwargs=%r)',
callable, args, kwargs)
callable_task, args, kwargs)
GLib.timeout_add(int(delta * 1000L), c)

View File

@@ -192,14 +192,14 @@ class File:
I represent a FILE line in a cue file.
"""
def __init__(self, path, format):
def __init__(self, path, file_format):
"""
@type path: unicode
"""
assert isinstance(path, unicode), "%r is not unicode" % path
self.path = path
self.format = format
self.format = file_format
def __repr__(self):
return '<File %r of format %s>' % (self.path, self.format)

View File

@@ -590,8 +590,8 @@ class AnalyzeTask(ctask.PopenTask):
def commandMissing(self):
raise common.MissingDependencyException('cd-paranoia')
def readbyteserr(self, bytes):
self._output.append(bytes)
def readbyteserr(self, bytes_stderr):
self._output.append(bytes_stderr)
def done(self):
if self.cwd:

View File

@@ -35,11 +35,11 @@ class AudioLengthTask(ctask.PopenTask):
def commandMissing(self):
raise common.MissingDependencyException('soxi')
def readbytesout(self, bytes):
self._output.append(bytes)
def readbytesout(self, bytes_stdout):
self._output.append(bytes_stdout)
def readbyteserr(self, bytes):
self._error.append(bytes)
def readbyteserr(self, bytes_stderr):
self._error.append(bytes_stderr)
def failed(self):
self.setException(Exception("soxi failed: %s" % "".join(self._error)))

View File

@@ -75,8 +75,8 @@ class AnalyzeFileTask(cdparanoia.AnalyzeTask):
def __init__(self, path):
self.command = ['cat', path]
def readbytesout(self, bytes):
self.readbyteserr(bytes)
def readbytesout(self, bytes_stdout):
self.readbyteserr(bytes_stdout)
class CacheTestCase(common.TestCase):