flake8: Add hacking

This commit is contained in:
Florian Bruhin 2016-04-08 07:35:53 +02:00
parent 735db072c6
commit 642dc46ba9
12 changed files with 25 additions and 13 deletions

View File

@ -1228,7 +1228,8 @@ class DownloadManager(QAbstractListModel):
def flags(self, _index):
"""Override flags so items aren't selectable.
The default would be Qt.ItemIsEnabled | Qt.ItemIsSelectable."""
The default would be Qt.ItemIsEnabled | Qt.ItemIsSelectable.
"""
return Qt.ItemIsEnabled | Qt.ItemNeverHasChildren
def rowCount(self, parent=QModelIndex()):

View File

@ -261,7 +261,8 @@ class CommandRunner(QObject):
"""Run a command and display exceptions in the statusbar.
Contrary to run_safely, error messages are queued so this is more
suitable to use while initializing."""
suitable to use while initializing.
"""
try:
self.run(text, count)
except (cmdexc.CommandMetaError, cmdexc.CommandError) as e:

View File

@ -147,7 +147,8 @@ class TabCompletionModel(base.BaseCompletionModel):
"""A model to complete on open tabs across all windows.
Used for switching the buffer command."""
Used for switching the buffer command.
"""
# https://github.com/The-Compiler/qutebrowser/issues/545
# pylint: disable=abstract-method

View File

@ -32,7 +32,8 @@ class UrlCompletionModel(base.BaseCompletionModel):
"""A model which combines bookmarks, quickmarks and web history URLs.
Used for the `open` command."""
Used for the `open` command.
"""
# https://github.com/The-Compiler/qutebrowser/issues/545
# pylint: disable=abstract-method

View File

@ -198,7 +198,8 @@ class _CrashDialog(QDialog):
def _init_text(self):
"""Initialize the main text to be displayed on an exception.
Should be extended by subclasses to set the actual text."""
Should be extended by subclasses to set the actual text.
"""
self._lbl = QLabel(wordWrap=True, openExternalLinks=True,
textInteractionFlags=Qt.LinksAccessibleByMouse)
self._vbox.addWidget(self._lbl)

View File

@ -267,7 +267,8 @@ def remove_inputhook():
"""Remove the PyQt input hook.
Doing this means we can't use the interactive shell anymore (which we don't
anyways), but we can use pdb instead."""
anyways), but we can use pdb instead.
"""
from PyQt5.QtCore import pyqtRemoveInputHook
pyqtRemoveInputHook()

View File

@ -31,7 +31,8 @@ import os
def get_latest_pdfjs_url():
"""Get the URL of the latest pdf.js prebuilt package.
Returns a (version, url)-tuple."""
Returns a (version, url)-tuple.
"""
github_api = 'https://api.github.com'
endpoint = 'repos/mozilla/pdf.js/releases/latest'
request_url = '{}/{}'.format(github_api, endpoint)

View File

@ -31,6 +31,10 @@ exclude = .venv,.hypothesis,.git,__pycache__,resources.py
# (PEP257 got changed, but let's stick to the old standard)
# D402: First line should not be function's signature (false-positives)
# FI10 - FI15: __future__ import missing
# H201: bare except
# H238: Use new-stule classes
# H301: one import per line
# H306: imports not in alphabetical order
ignore =
E128,E226,E265,E501,E402,E266,
F401,
@ -38,7 +42,8 @@ ignore =
L101,L102,L103,L201,L202,L203,L204,L207,L302,
P101,P102,P103,
D102,D103,D104,D105,D209,D211,D402,
FI10,FI11,FI12,FI13,FI14,FI15
FI10,FI11,FI12,FI13,FI14,FI15,
H201,H238,H301,H306
max-complexity = 12
putty-ignore =
/# pylint: disable=invalid-name/ : +N801,N806

View File

@ -326,7 +326,8 @@ def compare_session(quteproc, expected):
def no_crash():
"""Don't do anything.
This is actually a NOP as a crash is already checked in the log."""
This is actually a NOP as a crash is already checked in the log.
"""
pass

View File

@ -46,8 +46,7 @@ def percentage(qtbot):
(5, '[ 5%]'),
])
def test_percentage_text(percentage, y, expected):
"""
Test text displayed by the widget based on the y position of a page.
"""Test text displayed by the widget based on the y position of a page.
Args:
y: y position of the page as an int in the range [0, 100].

View File

@ -104,8 +104,7 @@ foo\ bar/foo bar/foo\ bar/
def _parse_split_test_data_str():
"""
Parse the test data set into a namedtuple to use in tests.
"""Parse the test data set into a namedtuple to use in tests.
Returns:
A list of namedtuples with str attributes: input, keep, no_keep

View File

@ -161,6 +161,7 @@ deps =
flake8-tuple==0.2.9
flake8-tidy-imports==1.0.0
flake8-future-import==0.3.0
hacking==0.10.2
pep257==0.7.0 # still needed by flake8-docstrings but ignored
pydocstyle==1.0.0
commands =