Replace filter calls with list comprehensions

This commit is contained in:
JoeLametta
2018-05-02 08:15:00 +00:00
parent 4280dbfafc
commit 7dff041362
2 changed files with 4 additions and 4 deletions

View File

@@ -231,7 +231,7 @@ def verify_result(result, responses, checksums):
# exclude HTOA from AccurateRip verification
# NOTE: if pre-gap hidden audio support is expanded to include
# tracks other than HTOA, this is invalid.
tracks = filter(lambda t: t.number != 0, result.tracks)
tracks = [t for t in result.tracks if t.number != 0]
if not tracks:
return False
_assign_checksums_and_confidences(tracks, checksums, responses)
@@ -251,10 +251,10 @@ def print_report(result):
conf = '(max confidence %3d)' % track.AR['DBMaxConfidence']
if track.AR['v1']['DBCRC'] or track.AR['v2']['DBCRC']:
status = 'rip accurate'
db = ', '.join(filter(None, (
db = ', '.join([_f for _f in (
track.AR['v1']['DBCRC'],
track.AR['v2']['DBCRC']
)))
) if _f])
max_conf = max(
[track.AR[v]['DBConfidence'] for v in ('v1', 'v2')]
)

View File

@@ -570,7 +570,7 @@ class Program:
checksums = accurip.calculate_checksums([
os.path.join(os.path.dirname(self.cuePath), t.indexes[1].path)
for t in filter(lambda t: t.number != 0, cueImage.cue.table.tracks)
for t in [t for t in cueImage.cue.table.tracks if t.number != 0]
])
if not (checksums and any(checksums['v1']) and any(checksums['v2'])):
return False