Fix pylint/flake8 for sql work.

This commit is contained in:
Ryan Roden-Corrent 2017-04-06 12:02:43 -04:00
parent 8ff45331df
commit 3e63b62d6e
4 changed files with 6 additions and 10 deletions

View File

@ -479,8 +479,8 @@ def _init_modules(args, crash_handler):
def _import_history(): def _import_history():
"""Import a history text file into sqlite if it exists. """Import a history text file into sqlite if it exists.
In older versions of qutebrowser, history was stored in a text format. In older versions of qutebrowser, history was stored in a text format.
This converts that file into the new sqlite format and removes it. This converts that file into the new sqlite format and removes it.
""" """
path = os.path.join(standarddir.data(), 'history') path = os.path.join(standarddir.data(), 'history')
if not os.path.isfile(path): if not os.path.isfile(path):

View File

@ -20,13 +20,11 @@
"""Simple history which gets written to disk.""" """Simple history which gets written to disk."""
import time import time
import os
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QUrl from PyQt5.QtCore import pyqtSignal, pyqtSlot, QUrl
from qutebrowser.commands import cmdutils from qutebrowser.commands import cmdutils
from qutebrowser.utils import (utils, objreg, standarddir, log, qtutils, from qutebrowser.utils import utils, objreg, log, qtutils, usertypes, message
usertypes, message)
from qutebrowser.misc import objects, sql from qutebrowser.misc import objects, sql
@ -201,7 +199,7 @@ class WebHistory(sql.SqlTable):
def read(self, path): def read(self, path):
"""Import a text file into the sql database.""" """Import a text file into the sql database."""
with open(path, 'r') as f: with open(path, 'r', encoding='utf-8') as f:
rows = [] rows = []
for line in f: for line in f:
try: try:

View File

@ -21,7 +21,7 @@ import os.path
import pytest_bdd as bdd import pytest_bdd as bdd
from PyQt5.QtSql import QSqlDatabase, QSqlQuery from PyQt5.QtSql import QSqlDatabase
bdd.scenarios('history.feature') bdd.scenarios('history.feature')

View File

@ -22,8 +22,6 @@
import logging import logging
import pytest import pytest
import hypothesis
from hypothesis import strategies
from PyQt5.QtCore import QUrl from PyQt5.QtCore import QUrl
from qutebrowser.browser import history from qutebrowser.browser import history
@ -69,7 +67,7 @@ def test_get_recent(hist):
hist.add_url(QUrl('http://www.qutebrowser.org/'), atime=67890) hist.add_url(QUrl('http://www.qutebrowser.org/'), atime=67890)
hist.add_url(QUrl('http://example.com/'), atime=12345) hist.add_url(QUrl('http://example.com/'), atime=12345)
assert list(hist.get_recent()) == [ assert list(hist.get_recent()) == [
('http://www.qutebrowser.org/', '', 67890 , False), ('http://www.qutebrowser.org/', '', 67890, False),
('http://example.com/', '', 12345, False), ('http://example.com/', '', 12345, False),
] ]