In Python 3 print is a function

This commit is contained in:
JoeLametta
2018-05-02 08:00:00 +00:00
parent 37fd1c6bb2
commit 44ece38740
12 changed files with 36 additions and 36 deletions

View File

@@ -333,7 +333,7 @@ Log files will log the path to tracks relative to this directory.
sys.stdout.write("output directory %s already exists\n" %
dirname.encode('utf-8'))
else:
print("creating output directory %s" % dirname.encode('utf-8'))
print(("creating output directory %s" % dirname.encode('utf-8')))
os.makedirs(dirname)
# FIXME: turn this into a method
@@ -460,14 +460,14 @@ Log files will log the path to tracks relative to this directory.
htoa = self.program.getHTOA()
if htoa:
start, stop = htoa
print('found Hidden Track One Audio from frame %d to %d' % (
start, stop))
print(('found Hidden Track One Audio from frame %d to %d' % (
start, stop)))
_ripIfNotRipped(0)
for i, track in enumerate(self.itable.tracks):
# FIXME: rip data tracks differently
if not track.audio:
print('skipping data track %d, not implemented' % (i + 1))
print(('skipping data track %d, not implemented' % (i + 1)))
# FIXME: make it work for now
track.indexes[1].relative = 0
continue

View File

@@ -79,7 +79,7 @@ Retags the image from the given .cue files with tags obtained from MusicBrainz.
prompt=self.options.prompt)
if not prog.metadata:
print 'Not in MusicBrainz database, skipping'
print('Not in MusicBrainz database, skipping')
continue
prog.metadata.discid = mbdiscid
@@ -98,10 +98,10 @@ Retags the image from the given .cue files with tags obtained from MusicBrainz.
runner.run(t)
path = os.path.basename(path)
if t.changed:
print 'Retagged %s' % path
print('Retagged %s' % path)
else:
print '%s already tagged correctly' % path
print
print('%s already tagged correctly' % path)
print()
class Verify(BaseCommand):

View File

@@ -105,5 +105,5 @@ You can get help on subcommands by using the -h option to the subcommand.
self.parser.print_help()
sys.exit(0)
if self.options.version:
print "whipper %s" % whipper.__version__
print("whipper %s" % whipper.__version__)
sys.exit(0)

View File

@@ -19,26 +19,26 @@ Example disc id: KnpGsLhvH.lPrNc1PBL21lb9Bg4-"""
try:
discId = unicode(self.options.mbdiscid)
except IndexError:
print 'Please specify a MusicBrainz disc id.'
print('Please specify a MusicBrainz disc id.')
return 3
metadatas = musicbrainz(discId)
print '%d releases' % len(metadatas)
print('%d releases' % len(metadatas))
for i, md in enumerate(metadatas):
print '- Release %d:' % (i + 1, )
print ' Artist: %s' % md.artist.encode('utf-8')
print ' Title: %s' % md.title.encode('utf-8')
print ' Type: %s' % md.releaseType.encode('utf-8') # noqa: E501
print ' URL: %s' % md.url
print ' Tracks: %d' % len(md.tracks)
print('- Release %d:' % (i + 1, ))
print(' Artist: %s' % md.artist.encode('utf-8'))
print(' Title: %s' % md.title.encode('utf-8'))
print(' Type: %s' % md.releaseType.encode('utf-8')) # noqa: E501
print(' URL: %s' % md.url)
print(' Tracks: %d' % len(md.tracks))
if md.catalogNumber:
print ' Cat no: %s' % md.catalogNumber
print(' Cat no: %s' % md.catalogNumber)
if md.barcode:
print ' Barcode: %s' % md.barcode
print(' Barcode: %s' % md.barcode)
for j, track in enumerate(md.tracks):
print ' Track %2d: %s - %s' % (
print(' Track %2d: %s - %s' % (
j + 1, track.artist.encode('utf-8'),
track.title.encode('utf-8')
)
))

View File

@@ -271,9 +271,9 @@ def print_report(result):
logger.error(
'no track AR CRC on non-HTOA track %d' % track.number
)
print('track %2d: unknown (error)' % track.number)
print(('track %2d: unknown (error)' % track.number))
else:
print('track %2d: %-16s %-23s v1 [%s], v2 [%s], DB [%s]' % (
print(('track %2d: %-16s %-23s v1 [%s], v2 [%s], DB [%s]' % (
track.number, status, conf,
track.AR['v1']['CRC'], track.AR['v2']['CRC'], db
))
)))

View File

@@ -425,7 +425,7 @@ class Program:
mbidTrack = track.mbid
mbidTrackArtist = track.mbidArtist
except IndexError, e:
print 'ERROR: no track %d found, %r' % (number, e)
print('ERROR: no track %d found, %r' % (number, e))
raise
else:
# htoa defaults to disc's artist

View File

@@ -167,10 +167,10 @@ if __name__ == '__main__':
shell, commands, tail = ('sh', ('ls', 'echo HELLO WORLD'), '\n')
a = Popen(shell, stdin=PIPE, stdout=PIPE)
print recv_some(a),
print(recv_some(a))
for cmd in commands:
send_all(a, cmd + tail)
print recv_some(a),
print(recv_some(a))
send_all(a, 'exit' + tail)
print recv_some(a, e=0)
print(recv_some(a, e=0))
a.wait()

View File

@@ -150,7 +150,7 @@ class Task(LogStub):
self.debug('stopping')
self.running = False
if not self.runner:
print 'ERROR: stopping task which is already stopped'
print('ERROR: stopping task which is already stopped')
import traceback
traceback.print_stack()
self.runner = None
@@ -214,7 +214,7 @@ class Task(LogStub):
def schedule(self, delta, callable, *args, **kwargs):
if not self.runner:
print "ERROR: scheduling on a task that's altready stopped"
print("ERROR: scheduling on a task that's altready stopped")
import traceback
traceback.print_stack()
return

View File

@@ -130,7 +130,7 @@ class CueFile(object):
if m:
if not currentTrack:
self.message(number, 'INDEX without preceding TRACK')
print 'ouch'
print('ouch')
continue
indexNumber = int(m.expand('\\1'))

View File

@@ -338,7 +338,7 @@ class TocFile(object):
if m:
if not currentTrack:
self.message(number, 'START without preceding TRACK')
print 'ouch'
print('ouch')
continue
length = common.msfToFrames(m.group('length'))
@@ -362,7 +362,7 @@ class TocFile(object):
if m:
if not currentTrack:
self.message(number, 'INDEX without preceding TRACK')
print 'ouch'
print('ouch')
continue
indexNumber += 1

View File

@@ -384,7 +384,7 @@ class ReadTrackTask(task.Task):
if not self.exception and self._popen.returncode != 0:
if self._errors:
print "\n".join(self._errors)
print("\n".join(self._errors))
else:
logger.warning('exit code %r', self._popen.returncode)
self.exception = ReturnCodeError(self._popen.returncode)
@@ -549,7 +549,7 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
else:
logger.debug('stop: exception %r', self.exception)
except Exception, e:
print 'WARNING: unhandled exception %r' % (e, )
print('WARNING: unhandled exception %r' % (e, ))
task.MultiSeparateTask.stop(self)

View File

@@ -31,5 +31,5 @@ def unmount_device(device):
logger.debug('possibly unmount real path %r' % device)
proc = open('/proc/mounts').read()
if device in proc:
print 'Device %s is mounted, unmounting' % device
print('Device %s is mounted, unmounting' % device)
os.system('umount %s' % device)