diff --git a/.run_checks b/.run_checks
index 6f60d98b9..2c435ab40 100644
--- a/.run_checks
+++ b/.run_checks
@@ -8,7 +8,7 @@ targets=qutebrowser,scripts
# D209: Blank line before closing """ (removed from PEP257)
# D402: First line should not be function's signature (false-positives)
disable=D102,D209,D402
-exclude=test_.*
+exclude=resources.py,test_content_disposition.py
[pylint]
args=--output-format=colorized,--reports=no,--rcfile=.pylintrc
diff --git a/qutebrowser/app.py b/qutebrowser/app.py
index a3a0ffa24..be0ede32e 100644
--- a/qutebrowser/app.py
+++ b/qutebrowser/app.py
@@ -457,7 +457,9 @@ class Application(QApplication):
@pyqtSlot()
def _handle_signal_wakeup(self):
- """This gets called via self._signal_notifier when there's a signal.
+ """Handle a newly arrived signal.
+
+ This gets called via self._signal_notifier when there's a signal.
Python will get control here, so the signal will get handled.
"""
diff --git a/qutebrowser/browser/cache.py b/qutebrowser/browser/cache.py
index 72c914edf..9087bd9d8 100644
--- a/qutebrowser/browser/cache.py
+++ b/qutebrowser/browser/cache.py
@@ -59,7 +59,7 @@ class DiskCache(QNetworkDiskCache):
return super().cacheSize()
def fileMetaData(self, filename):
- """Returns the QNetworkCacheMetaData for the cache file filename.
+ """Return the QNetworkCacheMetaData for the cache file filename.
Args:
filename: The file name as a string.
@@ -137,7 +137,7 @@ class DiskCache(QNetworkDiskCache):
return super().remove(url)
def updateMetaData(self, meta_data):
- """Updates the cache meta date for the meta_data's url to meta_data.
+ """Update the cache meta date for the meta_data's url to meta_data.
Args:
meta_data: A QNetworkCacheMetaData object.
@@ -148,7 +148,7 @@ class DiskCache(QNetworkDiskCache):
super().updateMetaData(meta_data)
def clear(self):
- """Removes all items from the cache."""
+ """Remove all items from the cache."""
if objreg.get('general', 'private-browsing'):
return
else:
diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py
index c5280f3fa..ae3e2548b 100644
--- a/qutebrowser/browser/downloads.py
+++ b/qutebrowser/browser/downloads.py
@@ -58,7 +58,7 @@ def _download_dir():
def _path_suggestion(filename):
- """Get the suggested file path
+ """Get the suggested file path.
Args:
filename: The filename to use if included in the suggestion.
@@ -289,7 +289,7 @@ class DownloadItem(QObject):
total=total, errmsg=errmsg))
def _create_fileobj(self):
- """Creates a file object using the internal filename."""
+ """Create a file object using the internal filename."""
try:
fileobj = open(self._filename, 'wb')
except OSError as e:
@@ -395,7 +395,7 @@ class DownloadItem(QObject):
self.data_changed.emit()
def delete(self):
- """Delete the downloaded file"""
+ """Delete the downloaded file."""
try:
if self._filename is not None and os.path.exists(self._filename):
os.remove(self._filename)
@@ -451,7 +451,7 @@ class DownloadItem(QObject):
self._create_fileobj()
def _create_full_filename(self, filename):
- """Tries to create the full filename.
+ """Try to create the full filename.
Return:
True if the full filename was created, False otherwise.
@@ -785,7 +785,7 @@ class DownloadManager(QAbstractListModel):
return download
def raise_no_download(self, count):
- """Raise an exception that the download doesn't exist
+ """Raise an exception that the download doesn't exist.
Args:
count: The index of the download
@@ -987,7 +987,7 @@ class DownloadManager(QAbstractListModel):
self.endRemoveRows()
def update_indexes(self):
- """Update indexes of all DownloadItems"""
+ """Update indexes of all DownloadItems."""
first_idx = None
for i, d in enumerate(self.downloads, 1):
if first_idx is None and d.index != i:
diff --git a/qutebrowser/browser/downloadview.py b/qutebrowser/browser/downloadview.py
index 5c50b0b7d..ef016e799 100644
--- a/qutebrowser/browser/downloadview.py
+++ b/qutebrowser/browser/downloadview.py
@@ -31,9 +31,7 @@ from qutebrowser.utils import qtutils, utils, objreg
def update_geometry(obj):
- """WORKAROUND
-
- This is a horrible workaround for some weird PyQt bug (probably).
+ """Weird WORKAROUND for some weird PyQt bug (probably).
This actually should be a method of DownloadView, but for some reason the
rowsInserted/rowsRemoved signals don't get disconnected from this method
@@ -44,7 +42,6 @@ def update_geometry(obj):
Original bug: https://github.com/The-Compiler/qutebrowser/issues/167
Workaround bug: https://github.com/The-Compiler/qutebrowser/issues/171
"""
-
def _update_geometry():
"""Actually update the geometry if the object still exists."""
if sip.isdeleted(obj):
diff --git a/qutebrowser/browser/http.py b/qutebrowser/browser/http.py
index 27575ce4c..0b2c74eba 100644
--- a/qutebrowser/browser/http.py
+++ b/qutebrowser/browser/http.py
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see .
-"""Other utilities which don't fit anywhere else. """
+"""Other utilities which don't fit anywhere else."""
import os.path
diff --git a/qutebrowser/browser/network/qutescheme.py b/qutebrowser/browser/network/qutescheme.py
index 9954d87e8..864f64345 100644
--- a/qutebrowser/browser/network/qutescheme.py
+++ b/qutebrowser/browser/network/qutescheme.py
@@ -170,7 +170,7 @@ def qute_help(win_id, request):
def qute_settings(win_id, _request):
- """Handler for qute:settings. View/change qute configuration"""
+ """Handler for qute:settings. View/change qute configuration."""
html = jinja.env.get_template('settings.html').render(
win_id=win_id, title='settings', config=configdata)
return html.encode('UTF-8', errors='xmlcharrefreplace')
diff --git a/qutebrowser/browser/rfc6266.py b/qutebrowser/browser/rfc6266.py
index 2fc389fc0..62d7b705b 100644
--- a/qutebrowser/browser/rfc6266.py
+++ b/qutebrowser/browser/rfc6266.py
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see .
-"""pyPEG parsing for the RFC 6266 (Content-Disposition) header. """
+"""pyPEG parsing for the RFC 6266 (Content-Disposition) header."""
import collections
import urllib.parse
@@ -121,6 +121,7 @@ class Language(str):
FIXME: This grammar is not 100% correct yet.
https://github.com/The-Compiler/qutebrowser/issues/105
"""
+
grammar = re.compile('[A-Za-z0-9-]+')
@@ -234,7 +235,7 @@ class ContentDisposition:
"""
def __init__(self, disposition='inline', assocs=None):
- """This constructor is used internally after parsing the header.
+ """Used internally after parsing the header.
Instances should generally be created from a factory
function, such as parse_headers and its variants.
@@ -264,7 +265,6 @@ class ContentDisposition:
well, due to a certain browser using the part after the dot for
mime-sniffing. Saving it to a database is fine by itself though.
"""
-
if 'filename*' in self.assocs:
return self.assocs['filename*']
elif 'filename' in self.assocs:
diff --git a/qutebrowser/browser/tabhistory.py b/qutebrowser/browser/tabhistory.py
index 2099688bf..3263f7a1e 100644
--- a/qutebrowser/browser/tabhistory.py
+++ b/qutebrowser/browser/tabhistory.py
@@ -141,7 +141,6 @@ def serialize(items):
If 'data' goes out of scope, reading from 'stream' will result in a
segfault!
"""
-
data = QByteArray()
stream = QDataStream(data, QIODevice.ReadWrite)
user_data = []
diff --git a/qutebrowser/commands/argparser.py b/qutebrowser/commands/argparser.py
index cede71017..30299128b 100644
--- a/qutebrowser/commands/argparser.py
+++ b/qutebrowser/commands/argparser.py
@@ -86,7 +86,6 @@ class ArgumentParser(argparse.ArgumentParser):
def enum_getter(enum):
"""Function factory to get an enum getter."""
-
def _get_enum_item(key):
"""Helper function to get an enum item.
@@ -104,7 +103,6 @@ def enum_getter(enum):
def multitype_conv(tpl):
"""Function factory to get a type converter for a choice of types."""
-
def _convert(value):
"""Convert a value according to an iterable of possible arg types."""
for typ in set(tpl):
diff --git a/qutebrowser/commands/command.py b/qutebrowser/commands/command.py
index 437355cb7..498eed62d 100644
--- a/qutebrowser/commands/command.py
+++ b/qutebrowser/commands/command.py
@@ -433,7 +433,6 @@ class Command:
Return:
An (args, kwargs) tuple.
"""
-
args = []
kwargs = {}
signature = inspect.signature(self.handler)
diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py
index f15ef0da9..3fb0aefd3 100644
--- a/qutebrowser/config/config.py
+++ b/qutebrowser/config/config.py
@@ -85,7 +85,6 @@ class change_filter: # pylint: disable=invalid-name
Return:
The decorated function.
"""
-
@pyqtSlot(str, str)
@functools.wraps(func)
def wrapper(wrapper_self, sectname=None, optname=None):
diff --git a/qutebrowser/test/browser/test_webelem.py b/qutebrowser/test/browser/test_webelem.py
index f3c0306a3..bc423521b 100644
--- a/qutebrowser/test/browser/test_webelem.py
+++ b/qutebrowser/test/browser/test_webelem.py
@@ -205,25 +205,26 @@ class IsVisibleIframeTests(unittest.TestCase):
"""
def setUp(self):
- """Set up this base situation
- 0, 0 300, 0
- ##############################
- # #
- 0,10 # iframe 100,10 #
- #********** #
- #*e * elem1: 0, 0 in iframe (visible)
- #* * #
- #* e * elem2: 20,90 in iframe (visible)
- #********** #
- 0,110 #. .100,110 #
- #. . #
- #. e . elem3: 20,150 in iframe (not visible)
- #.......... #
- # e elem4: 30, 180 in main frame (visible)
- # #
- # frame #
- ##############################
- 300, 0 300, 300
+ """Set up the following base situation.
+
+ 0, 0 300, 0
+ ##############################
+ # #
+ 0,10 # iframe 100,10 #
+ #********** #
+ #*e * elem1: 0, 0 in iframe (visible)
+ #* * #
+ #* e * elem2: 20,90 in iframe (visible)
+ #********** #
+ 0,110 #. .100,110 #
+ #. . #
+ #. e . elem3: 20,150 in iframe (not visible)
+ #.......... #
+ # e elem4: 30, 180 in main frame (visible)
+ # #
+ # frame #
+ ##############################
+ 300, 0 300, 300
"""
self.frame = stubs.FakeWebFrame(QRect(0, 0, 300, 300))
self.iframe = stubs.FakeWebFrame(QRect(0, 10, 100, 100),
@@ -327,7 +328,7 @@ class GetChildFramesTests(unittest.TestCase):
frame.childFrames.assert_called_once_with()
def test_one_level(self):
- r"""Test get_child_frames with this tree:
+ r"""Test get_child_frames with one level of children.
o parent
/ \
@@ -346,7 +347,7 @@ class GetChildFramesTests(unittest.TestCase):
child2.childFrames.assert_called_once_with()
def test_multiple_levels(self):
- r"""Test get_child_frames with this tree:
+ r"""Test get_child_frames with multiple levels of children.
o root
/ \
diff --git a/qutebrowser/test/utils/test_urlutils.py b/qutebrowser/test/utils/test_urlutils.py
index b76ea09b4..58868acb7 100644
--- a/qutebrowser/test/utils/test_urlutils.py
+++ b/qutebrowser/test/utils/test_urlutils.py
@@ -93,25 +93,25 @@ class SearchUrlTests(unittest.TestCase):
self.assertEqual(url.query(), 'q=testfoo')
def test_engine_pre(self):
- """Test first word is search engine name"""
+ """Test search engine name with one word."""
url = urlutils._get_search_url('test testfoo')
self.assertEqual(url.host(), 'www.qutebrowser.org')
self.assertEqual(url.query(), 'q=testfoo')
def test_engine_pre_multiple_words(self):
- """Test first word is search engine name"""
+ """Test search engine name with multiple words."""
url = urlutils._get_search_url('test testfoo bar foo')
self.assertEqual(url.host(), 'www.qutebrowser.org')
self.assertEqual(url.query(), 'q=testfoo bar foo')
def test_engine_pre_whitespace_at_end(self):
- """Test first word is search engine name"""
+ """Test search engine name with one word and whitespace."""
url = urlutils._get_search_url('test testfoo ')
self.assertEqual(url.host(), 'www.qutebrowser.org')
self.assertEqual(url.query(), 'q=testfoo')
def test_engine_with_bang_pre(self):
- """Test search engine with a prepended !hasbang."""
+ """Test search engine with a prepended !bang."""
url = urlutils._get_search_url('!python testfoo')
self.assertEqual(url.host(), 'www.example.com')
self.assertEqual(url.query(), 'q=%21python testfoo')
@@ -177,13 +177,13 @@ class IsUrlTests(unittest.TestCase):
@mock.patch('qutebrowser.utils.urlutils.config', new=stubs.ConfigStub(
get_config_stub(True)))
def test_search_autosearch(self):
- """Test explicit search with auto-search=True"""
+ """Test explicit search with auto-search=True."""
self.assertFalse(urlutils.is_url('test foo'))
@mock.patch('qutebrowser.utils.urlutils.config', new=stubs.ConfigStub(
get_config_stub(False)))
def test_search_no_autosearch(self):
- """Test explicit search with auto-search=False"""
+ """Test explicit search with auto-search=False."""
self.assertFalse(urlutils.is_url('test foo'))
diff --git a/qutebrowser/test/utils/test_utils.py b/qutebrowser/test/utils/test_utils.py
index 7a143724a..088ce49c7 100644
--- a/qutebrowser/test/utils/test_utils.py
+++ b/qutebrowser/test/utils/test_utils.py
@@ -364,7 +364,9 @@ class IsEnumTests(unittest.TestCase):
def test_class(self):
"""Test is_enum with a non-enum class."""
class Test:
- """Test class for is_enum"""
+
+ """Test class for is_enum."""
+
pass
self.assertFalse(utils.is_enum(Test))
diff --git a/qutebrowser/utils/debug.py b/qutebrowser/utils/debug.py
index 0ccde55ab..72ef4cf9e 100644
--- a/qutebrowser/utils/debug.py
+++ b/qutebrowser/utils/debug.py
@@ -51,7 +51,6 @@ def log_signals(obj):
Can be used as class decorator.
"""
-
def log_slot(obj, signal, *args):
"""Slot connected to a signal to log it."""
dbg = dbg_signal(signal, args)
diff --git a/qutebrowser/utils/jinja.py b/qutebrowser/utils/jinja.py
index a1633efc1..3e2519ad2 100644
--- a/qutebrowser/utils/jinja.py
+++ b/qutebrowser/utils/jinja.py
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see .
-"""Utilities related to jinja2. """
+"""Utilities related to jinja2."""
import os.path
@@ -49,7 +49,7 @@ class Loader(jinja2.BaseLoader):
def _guess_autoescape(template_name):
- """Turns autoescape on/off based on the filetype.
+ """Turn autoescape on/off based on the filetype.
Based on http://jinja.pocoo.org/docs/dev/api/#autoescaping
"""
diff --git a/qutebrowser/utils/message.py b/qutebrowser/utils/message.py
index 5dfd4a9f3..e96597124 100644
--- a/qutebrowser/utils/message.py
+++ b/qutebrowser/utils/message.py
@@ -88,7 +88,10 @@ def _get_bridge(win_id):
@pyqtSlot()
def on_focus_changed():
- """Gets called when a new window has been focused."""
+ """Show queued messages when a new window has been focused.
+
+ Gets called when a new window has been focused.
+ """
while _QUEUED:
msg = _QUEUED.pop()
delta = datetime.datetime.now() - msg.time
diff --git a/qutebrowser/utils/urlutils.py b/qutebrowser/utils/urlutils.py
index 014aabb9f..649044fa1 100644
--- a/qutebrowser/utils/urlutils.py
+++ b/qutebrowser/utils/urlutils.py
@@ -193,7 +193,6 @@ def _has_explicit_scheme(url):
Args:
url: The URL as QUrl.
"""
-
# Note that generic URI syntax actually would allow a second colon
# after the scheme delimiter. Since we don't know of any URIs
# using this and want to support e.g. searching for scoped C++
diff --git a/qutebrowser/utils/utils.py b/qutebrowser/utils/utils.py
index ae491c852..e409f18ee 100644
--- a/qutebrowser/utils/utils.py
+++ b/qutebrowser/utils/utils.py
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see .
-"""Other utilities which don't fit anywhere else. """
+"""Other utilities which don't fit anywhere else."""
import io
import sys
@@ -383,11 +383,11 @@ class FakeIOStream(io.TextIOBase):
self.write = write_func
def flush(self):
- """This is only here to satisfy pylint."""
+ """Override flush() to satisfy pylint."""
return super().flush()
def isatty(self):
- """This is only here to satisfy pylint."""
+ """Override isatty() to satisfy pylint."""
return super().isatty()
@@ -459,7 +459,7 @@ class prevent_exceptions: # pylint: disable=invalid-name
self._predicate = predicate
def __call__(self, func):
- """Gets called when a function should be decorated.
+ """Called when a function should be decorated.
Args:
func: The function to be decorated.
diff --git a/scripts/run_checks.py b/scripts/run_checks.py
index 495f35e13..16c168672 100755
--- a/scripts/run_checks.py
+++ b/scripts/run_checks.py
@@ -18,7 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see .
-""" Run different codecheckers over a codebase.
+"""Run different codecheckers over a codebase.
Runs flake8, pylint, pep257, a CRLF/whitespace/conflict-checker and
pyroma/check-manifest by default.