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:
Laurent Bachelier 2014-10-06 14:23:20 +02:00
commit 74a4ef6723
73 changed files with 499 additions and 442 deletions

View file

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
from . import constants
@ -52,7 +53,7 @@ class DisplayCollectionMenuAction(VideoobBaseAction):
common_xbmc.end_of_directory(False)
def add_videos(self, _video, backend):
print _video
print(_video)
video = self.videoobmc.get_video(_video, backend)
if video:
MenuItemVideo(video).add_to_menu()

View file

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import print_function
import xbmc
import xbmcgui
@ -41,7 +42,7 @@ def get_addon_dir():
def display_error(msg):
xbmc.executebuiltin("XBMC.Notification(%s, %s)" % (get_translation('30200').decode('utf-8'), msg))
print msg
print(msg)
print_exc(msg)

View file

@ -1,5 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
from weboob.tools.application.base import Application
import os
@ -53,7 +54,7 @@ class Weboobmc(Application):
with open('/dev/null', 'w') as devnull:
process = subprocess.Popen(['which', executable], stdout=devnull)
if process.wait() != 0:
print 'Please install "%s"' % executable
print('Please install "%s"' % executable)
return False
return True

View file

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import print_function
import urllib
@ -33,11 +34,11 @@ def get_settings(key):
def display_error(error):
print "%s: %s" % ("ERROR", error)
print("%s: %s" % ("ERROR", error))
def display_info(msg):
print "%s: %s" % ("INFO", msg)
print("%s: %s" % ("INFO", msg))
def parse_params(paramStr):
@ -93,18 +94,18 @@ def create_param_url(paramsDic, quote_plus=False):
def add_menu_item(params={}):
print '%s => "%s"' % (params.get('name'), create_param_url(params))
print('%s => "%s"' % (params.get('name'), create_param_url(params)))
def add_menu_link(params={}):
print '[%s] %s (%s)' % (params.get('id'), params.get('name'), params.get('url'))
print('[%s] %s (%s)' % (params.get('id'), params.get('name'), params.get('url')))
#print params.get('itemInfoLabels')
#print params.get('c_items')
def end_of_directory(update=False):
print '******************************************************'
print('******************************************************')
def download_video(url, name, dir='./'):
print 'Downlaod a video %s from %s' % (name, url)
print('Downlaod a video %s from %s' % (name, url))

View file

@ -1,5 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
from .base.weboobmc2 import Weboobmc
from weboob.capabilities.video import BaseVideo, CapVideo
@ -22,7 +23,7 @@ class Videoobmc(Weboobmc):
for _backend, video in self.weboob.do(self._do_complete, self.count, fields, 'search_videos', **kwargs):
yield video
except Exception as e:
print e
print(e)
def get_video(self, video, _backend):
backend = self.weboob.get_backend(_backend)