Use the print function everywhere
python modernize.py --no-six -f libmodernize.fixes.fix_print -w With manual fixes as the import was put always on top.
This commit is contained in:
parent
d22656308a
commit
74a4ef6723
73 changed files with 499 additions and 442 deletions
|
|
@ -1,5 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=python et softtabstop=4 cinoptions=4 shiftwidth=4 ts=4 ai
|
||||
|
||||
# Copyright(C) 2011 Laurent Bachelier
|
||||
#
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import codecs
|
||||
|
|
@ -49,14 +50,14 @@ class Pastoob(ReplApplication):
|
|||
Get information about pastes.
|
||||
"""
|
||||
if not line:
|
||||
print >>self.stderr, 'This command takes an argument: %s' % self.get_command_help('info', short=True)
|
||||
print('This command takes an argument: %s' % self.get_command_help('info', short=True), file=self.stderr)
|
||||
return 2
|
||||
|
||||
self.start_format()
|
||||
for _id in line.split(' '):
|
||||
paste = self.get_object(_id, 'get_paste', ['id', 'title', 'language', 'public', 'contents'])
|
||||
if not paste:
|
||||
print >>self.stderr, 'Paste not found: %s' % _id
|
||||
print('Paste not found: %s' % _id, file=self.stderr)
|
||||
|
||||
self.format(paste)
|
||||
|
||||
|
|
@ -80,22 +81,22 @@ class Pastoob(ReplApplication):
|
|||
|
||||
def _get_op(self, _id, binary, command='get'):
|
||||
if not _id:
|
||||
print >>self.stderr, 'This command takes an argument: %s' % self.get_command_help(command, short=True)
|
||||
print('This command takes an argument: %s' % self.get_command_help(command, short=True), file=self.stderr)
|
||||
return 2
|
||||
|
||||
try:
|
||||
paste = self.get_object(_id, 'get_paste', ['contents'])
|
||||
except PasteNotFound:
|
||||
print >>self.stderr, 'Paste not found: %s' % _id
|
||||
print('Paste not found: %s' % _id, file=self.stderr)
|
||||
return 3
|
||||
if not paste:
|
||||
print >>self.stderr, 'Unable to handle paste: %s' % _id
|
||||
print('Unable to handle paste: %s' % _id, file=self.stderr)
|
||||
return 1
|
||||
|
||||
if binary:
|
||||
if self.interactive:
|
||||
if not self.ask('The console may become messed up. Are you sure you want to show a binary file on your terminal?', default=False):
|
||||
print >>self.stderr, 'Aborting.'
|
||||
print('Aborting.', file=self.stderr)
|
||||
return 1
|
||||
output = self.stdout
|
||||
output.write(paste.contents.decode('base64'))
|
||||
|
|
@ -135,7 +136,7 @@ class Pastoob(ReplApplication):
|
|||
else:
|
||||
contents = self.acquire_input()
|
||||
if not len(contents):
|
||||
print >>self.stderr, 'Empty paste, aborting.'
|
||||
print('Empty paste, aborting.', file=self.stderr)
|
||||
return 1
|
||||
|
||||
else:
|
||||
|
|
@ -147,7 +148,7 @@ class Pastoob(ReplApplication):
|
|||
with m as fp:
|
||||
contents = fp.read()
|
||||
except IOError as e:
|
||||
print >>self.stderr, 'Unable to open file "%s": %s' % (filename, e.strerror)
|
||||
print('Unable to open file "%s": %s' % (filename, e.strerror), file=self.stderr)
|
||||
return 1
|
||||
|
||||
if binary:
|
||||
|
|
@ -164,7 +165,7 @@ class Pastoob(ReplApplication):
|
|||
if len(backends):
|
||||
backend = choice(backends[max(backends.keys())])
|
||||
else:
|
||||
print >>self.stderr, 'No suitable backend found.'
|
||||
print('No suitable backend found.', file=self.stderr)
|
||||
return 1
|
||||
|
||||
p = backend.new_paste(_id=None)
|
||||
|
|
@ -175,7 +176,7 @@ class Pastoob(ReplApplication):
|
|||
p.title = os.path.basename(filename)
|
||||
p.contents = contents
|
||||
backend.post_paste(p, max_age=params['max_age'])
|
||||
print 'Successfuly posted paste: %s' % p.page_url
|
||||
print('Successfuly posted paste: %s' % p.page_url)
|
||||
|
||||
def get_params(self):
|
||||
return {'public': self.options.public,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue