Use flake8 if available instead of pyflakes

With flake8, we can check for more issues and ignore those who are not
real issues.

This allowed me to find genuine errors in:
- modules/boursorama/pages/account_history.py
- modules/ing/pages/login.py
- weboob/tools/application/qt/qt.py
I left one in weboob/tools/browser/browser.py for the time being.

Some PEP8 fixes on other files.
This commit is contained in:
Laurent Bachelier 2012-11-24 19:46:34 +01:00
commit 541d080c9d
18 changed files with 54 additions and 45 deletions

View file

@ -30,7 +30,7 @@ try:
import tty, termios
except ImportError:
PROMPT = '--Press return to continue--'
def readch():
def readch(): # NOQA
return sys.stdin.readline()
else:
PROMPT = '--Press a key to continue--'
@ -163,7 +163,6 @@ class IFormatter(object):
self.output(formatted)
return formatted
def format_obj(self, obj, alias=None):
"""
Format an object to be human-readable.

View file

@ -26,8 +26,7 @@ from PyQt4.QtCore import QTimer, SIGNAL, QObject, QString, QSize, QVariant, QMut
from PyQt4.QtGui import QMainWindow, QApplication, QStyledItemDelegate, \
QStyleOptionViewItemV4, QTextDocument, QStyle, \
QAbstractTextDocumentLayout, QPalette, QMessageBox, \
QSpinBox, QLineEdit, QComboBox, QCheckBox, QInputDialog, \
QLineEdit
QSpinBox, QLineEdit, QComboBox, QCheckBox, QInputDialog
from weboob.core.ouiboube import Weboob
from weboob.core.scheduler import IScheduler

View file

@ -21,7 +21,7 @@
try:
import sqlite3 as sqlite
except ImportError, e:
from pysqlite2 import dbapi2 as sqlite
from pysqlite2 import dbapi2 as sqlite # NOQA
from mechanize import CookieJar, Cookie
@ -47,7 +47,8 @@ class FirefoxCookieJar(CookieJar):
def load(self):
db = self.__connect()
if not db: return
if not db:
return
cookies = db.execute("""SELECT host, path, name, value, expiry, lastAccessed, isSecure
FROM moz_cookies
@ -83,12 +84,15 @@ class FirefoxCookieJar(CookieJar):
def save(self):
db = self.__connect()
if not db: return
if not db:
return
db.execute("DELETE FROM moz_cookies WHERE host LIKE '%%%s%%'" % self.domain)
for cookie in self:
if cookie.secure: secure = 1
else: secure = 0
if cookie.secure:
secure = 1
else:
secure = 0
if cookie.expires is not None:
expires = cookie.expires
else:

View file

@ -29,8 +29,8 @@ try:
from yaml import CLoader as Loader
from yaml import CDumper as Dumper
except ImportError:
from yaml import Loader
from yaml import Dumper
from yaml import Loader # NOQA
from yaml import Dumper # NOQA
from .iconfig import IConfig, ConfigError

View file

@ -27,4 +27,4 @@ try:
import simplejson as json
except ImportError:
# Python 2.6+ has a module similar to simplejson
import json
import json # NOQA

View file

@ -22,16 +22,15 @@ try:
from collections import OrderedDict
except ImportError:
try:
from simplejson import OrderedDict
from simplejson import OrderedDict # NOQA
except ImportError:
try:
from ordereddict import OrderedDict
from ordereddict import OrderedDict # NOQA
except ImportError:
## {{{ http://code.activestate.com/recipes/576693/ (r6)
from UserDict import DictMixin
class OrderedDict(dict, DictMixin):
class OrderedDict(dict, DictMixin): # NOQA
def __init__(self, *args, **kwds):
if len(args) > 1:
raise TypeError('expected at most 1 arguments, got %d' % len(args))
@ -123,7 +122,7 @@ except ImportError:
def __eq__(self, other):
if isinstance(other, OrderedDict):
return len(self)==len(other) and self.items() == other.items()
return len(self) == len(other) and self.items() == other.items()
return dict.__eq__(self, other)
def __ne__(self, other):

View file

@ -30,7 +30,7 @@ from elementtidy import TidyHTMLTreeBuilder
try:
from xml.etree import cElementTree as ElementTree
except ImportError:
from xml.etree import ElementTree
from xml.etree import ElementTree # NOQA
from .iparser import IParser

View file

@ -22,7 +22,7 @@ from html5lib import treebuilders, HTMLParser
try:
from xml.etree import cElementTree as ElementTree
except ImportError:
from xml.etree import ElementTree
from xml.etree import ElementTree # NOQA
from .iparser import IParser

View file

@ -23,7 +23,7 @@ import htmlentitydefs
try:
from xml.etree import cElementTree as ElementTree
except ImportError:
from xml.etree import ElementTree
from xml.etree import ElementTree # NOQA
from .iparser import IParser
@ -68,6 +68,7 @@ class HTMLTreeBuilder(_HTMLParser):
except:
pass
class HTMLParser(IParser):
def parse(self, data, encoding=None):
parser = HTMLTreeBuilder(encoding)