Easy spacing fixes, trailing stuff

Remove useless trailing \
Remove trailing spaces
Add missing empty lines

autopep8 -ir -j2 --select=E301,E302,E502,W291,W293,W391 .

Diff quickly checked.
This commit is contained in:
Laurent Bachelier 2013-03-15 20:01:49 +01:00
commit 7094931c92
231 changed files with 474 additions and 67 deletions

View file

@ -64,6 +64,7 @@ class ApplicationStorage(object):
if self.storage:
return self.storage.save('applications', self.name)
class BaseApplication(object):
"""
Base application.

View file

@ -50,9 +50,11 @@ class BackendNotGiven(Exception):
Exception.__init__(self, 'Please specify a backend to use for this argument (%s@backend_name). '
'Availables: %s.' % (id, ', '.join(name for name, backend in backends)))
class BackendNotFound(Exception):
pass
class ConsoleApplication(BaseApplication):
"""
Base application class for CLI applications.

View file

@ -24,6 +24,7 @@ __all__ = ['FormattersLoader', 'FormatterLoadError']
class FormatterLoadError(Exception):
pass
class FormattersLoader(object):
BUILTINS = ['htmltable', 'multiline', 'simple', 'table', 'csv', 'webkit', 'json']

View file

@ -70,7 +70,7 @@ class TableFormatter(IFormatter):
table = PrettyTable(list(column_headers))
for column_header in column_headers:
# API changed in python-prettytable. The try/except is a bad hack to support both versions
# Note: two versions are not exactly the same...
# Note: two versions are not exactly the same...
# (first one: header in center. Second one: left align for header too)
try:
table.set_field_align(column_header, 'l')

View file

@ -39,7 +39,7 @@ PLAYERS = (
class MediaPlayerNotFound(Exception):
def __init__(self):
Exception.__init__(self, u'No media player found on this system. Please install one of them: %s.' % \
Exception.__init__(self, u'No media player found on this system. Please install one of them: %s.' %
', '.join(player[0] for player in PLAYERS))
@ -75,7 +75,7 @@ class MediaPlayer(object):
"""
player_names = [player[0] for player in PLAYERS]
if not player_name:
self.logger.debug(u'No media player given. Using the first available from: %s.' % \
self.logger.debug(u'No media player given. Using the first available from: %s.' %
', '.join(player_names))
player_name = self.guess_player_name()
if player_name is None:

View file

@ -221,7 +221,7 @@ class BackendCfg(QDialog):
continue
item = QTreeWidgetItem(None, [instance_name, name])
item.setCheckState(0, Qt.Checked if params.get('_enabled', '1').lower() in ('1', 'y', 'true') \
item.setCheckState(0, Qt.Checked if params.get('_enabled', '1').lower() in ('1', 'y', 'true')
else Qt.Unchecked)
self.set_icon(item, info)

View file

@ -39,6 +39,7 @@ from ..base import BaseApplication
__all__ = ['QtApplication', 'QtMainWindow', 'QtDo', 'HTMLDelegate']
class QtScheduler(IScheduler):
def __init__(self, app):
self.app = app
@ -81,6 +82,7 @@ class QtScheduler(IScheduler):
def run(self):
self.app.exec_()
class QCallbacksManager(QObject):
class Request(object):
def __init__(self):
@ -132,6 +134,7 @@ class QCallbacksManager(QObject):
request.event.wait()
return request.answer
class QtApplication(QApplication, BaseApplication):
def __init__(self):
QApplication.__init__(self, sys.argv)
@ -143,10 +146,12 @@ class QtApplication(QApplication, BaseApplication):
def create_weboob(self):
return Weboob(scheduler=QtScheduler(self))
class QtMainWindow(QMainWindow):
def __init__(self, parent=None):
QMainWindow.__init__(self, parent)
class QtDo(QObject):
def __init__(self, weboob, cb, eb=None):
QObject.__init__(self)
@ -223,6 +228,7 @@ class QtDo(QObject):
def thread_eb(self, backend, error, backtrace):
self.emit(SIGNAL('eb'), backend, error, backtrace)
class HTMLDelegate(QStyledItemDelegate):
def paint(self, painter, option, index):
optionV4 = QStyleOptionViewItemV4(option)
@ -260,6 +266,7 @@ class HTMLDelegate(QStyledItemDelegate):
return QSize(doc.idealWidth(), max(doc.size().height(), optionV4.decorationSize.height()))
class _QtValueStr(QLineEdit):
def __init__(self, value):
QLineEdit.__init__(self)
@ -277,11 +284,13 @@ class _QtValueStr(QLineEdit):
self._value.set(unicode(self.text()))
return self._value
class _QtValueBackendPassword(_QtValueStr):
def get_value(self):
self._value._domain = None
return _QtValueStr.get_value(self)
class _QtValueBool(QCheckBox):
def __init__(self, value):
QCheckBox.__init__(self)
@ -297,6 +306,7 @@ class _QtValueBool(QCheckBox):
self._value.set(self.isChecked())
return self._value
class _QtValueInt(QSpinBox):
def __init__(self, value):
QSpinBox.__init__(self)
@ -312,6 +322,7 @@ class _QtValueInt(QSpinBox):
self._value.set(self.getValue())
return self._value
class _QtValueChoices(QComboBox):
def __init__(self, value):
QComboBox.__init__(self)
@ -332,6 +343,7 @@ class _QtValueChoices(QComboBox):
self._value.set(unicode(self.itemData(self.currentIndex()).toString()))
return self._value
def QtValue(value):
if isinstance(value, ValueBool):
klass = _QtValueBool