Make Python code more idiomatic

This commit is contained in:
JoeLametta
2018-05-02 08:45:00 +00:00
parent a484815106
commit 2b4140d300
12 changed files with 24 additions and 27 deletions

View File

@@ -46,7 +46,7 @@ class Image(object):
@type path: unicode
@param path: .cue path
"""
assert type(path) is unicode, "%r is not unicode" % path
assert isinstance(path, unicode), "%r is not unicode" % path
self._path = path
self.cue = cue.CueFile(path)
@@ -62,7 +62,7 @@ class Image(object):
@param path: .cue path
"""
assert type(path) is unicode, "%r is not unicode" % path
assert isinstance(path, unicode), "%r is not unicode" % path
return self.cue.getRealPath(path)
@@ -129,7 +129,7 @@ class ImageVerifyTask(task.MultiSeparateTask):
htoa = cue.table.tracks[0].indexes[0]
track = cue.table.tracks[0]
path = image.getRealPath(htoa.path)
assert type(path) is unicode, "%r is not unicode" % path
assert isinstance(path, unicode), "%r is not unicode" % path
logger.debug('schedule scan of audio length of %r', path)
taskk = AudioLengthTask(path)
self.addTask(taskk)
@@ -144,7 +144,7 @@ class ImageVerifyTask(task.MultiSeparateTask):
if length == -1:
path = image.getRealPath(index.path)
assert type(path) is unicode, "%r is not unicode" % path
assert isinstance(path, unicode), "%r is not unicode" % path
logger.debug('schedule scan of audio length of %r', path)
taskk = AudioLengthTask(path)
self.addTask(taskk)
@@ -190,7 +190,7 @@ class ImageEncodeTask(task.MultiSeparateTask):
def add(index):
path = image.getRealPath(index.path)
assert type(path) is unicode, "%r is not unicode" % 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))
outpath = os.path.join(outdir, root + '.' + 'flac')